Skip to content

Regression: property hooks syntax accepted on default 8.2 profile — Zend parse error (re-#22371, Zend/zend_language_parser.y) #22781

Closed

Description

@PurHur

Category

Regression: · php-src-strict · profile gate (re-#22371 / re-#18531)

Problem

Default profile (Zend PHP 8.2.32 reference) must parse-error property hook syntax. As of master@0ae5abab2 (2026-07-24), bin/vm.php parses and executes hooks — same leak #22371 closed 2026-07-22.

Repro Zend 8.2.32 VM (2026-07-24, default profile)
public string $x { get => ...; set => ...; } Parse error: unexpected token "{" runs (a B)

php-src reference

PHP implementation target

  • Parser / version gate in lib/ (language parser / profile checks) — reject hook property declarations on 8.2/8.3 profiles with a Zend-shaped Parse error (not a compile fatal)
  • Do not add C runtime branches

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/hooks_profile.php <<\"PHP\"
<?php
class T {
  private string $_x = \"a\";
  public string $x {
    get => $this->_x;
    set => $this->_x = strtoupper($value);
  }
}
$t = new T;
echo $t->x, \" \";
$t->x = \"b\";
echo $t->x, PHP_EOL;
PHP
php /tmp/hooks_profile.php; echo EXIT_ZEND:$?
php bin/vm.php /tmp/hooks_profile.php; echo EXIT_VM:$?'

Done when

  • Default profile: VM emits Zend-shaped parse error (non-zero); snippet does not run
  • PHP_COMPILER_PROFILE=8.4: same snippet still works (a B)
  • Compliance/test/repro guard; php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 24, 2026
  2. PurHur commented on Jul 24, 2026

    @PurHur
    OwnerAuthor

    Maintainer re-check (0ae5aba)

    Repro from the issue body is not reproducible on current master@0ae5abab2 — VM already matches Zend 8.2 rejection:

    Issue VM result (host php bin/vm.php, default profile)
    #22781 property hooks Parse error: unexpected token \"{\"
    #22782 typed class const syntax error, unexpected identifier \"X\", expecting \"=\"
    #22783 new T()->m() Parse error: unexpected token \"->\"
    #22784 public private(set) Fatal error: Multiple access type modifiers are not allowed

    Closing as already fixed / stale observation. Fresh PROFILE=8.3/8.4 gate gaps filed as #22792–#22795.

  3. PurHur commented on Jul 24, 2026

    @PurHur
    OwnerAuthor

    Closed: default-profile Zend rejection already matches on master@0ae5abab2 (see prior comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions