Skip to content

Regression: new Class()->method() accepted on 8.4.0-dev reference profile — Zend 8.2 parse error (re-#6974, Zend/zend_language_parser.y) #19684

Closed

Description

@PurHur

Category

language · php-src-strict · 8.4.0-dev reference profile gate

Problem

Dereferencable new without outer parentheses (new Greeter()->greet()) was implemented for PHP 8.4 (#6974), but the default 8.4.0-dev reference profile is supposed to match Zend 8.2 parse behavior for withheld 8.4 syntax (same pattern as typed class constants, asymmetric visibility, etc. in CompilerVersion).

On master today the construct parses and runs under the default profile while host Zend 8.2.31 parse-errors.

Repro Zend 8.2.31 VM default 8.4.0-dev (2026-07-16) PHP_COMPILER_PROFILE=8.4
echo new A()->x(); Parse error on -> prints 1 ❌ prints 1 (OK for forward 8.4)

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/newnp.php <<'"'"'PHP'"'"'
<?php
class A { public function x(){ return 1; } }
echo new A()->x(), "\n";
PHP
php /tmp/newnp.php; echo ZEND_EXIT:$?
php bin/vm.php /tmp/newnp.php; echo VM_EXIT:$?
PHP_COMPILER_PROFILE=8.4 php bin/vm.php /tmp/newnp.php'

Done when

  • Default 8.4.0-dev profile rejects the repro like Zend 8.2
  • PHP_COMPILER_PROFILE=8.4 still accepts and runs
  • Unit/compliance guard for both profiles
  • php-src-strict vs reference Zend; forward profile remains the 8.4 escape hatch

Activity

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

    @PurHur
    OwnerAuthor

    claim: Lane B implementer (Auto) — starting this run

    Trust gates (before claim):

    • make bootstrap-selfhost-link: green (OK /compiler/build/selfhost)
    • php script/bootstrap-inventory.php --check: red — stale docs/bootstrap-inventory.md (VmStreamSelect/VmPhpMemoryStream construct-flag drift only; not blocking this language fix)
    • ./script/release-readiness.sh --json: still running at claim time

    Implementing profile gate for dereferencable new without outer parens (#19684).

  3. PurHur commented on Jul 16, 2026

    @PurHur
    OwnerAuthor

    Merged #19692

    Verification

    • Issue repro: Zend + default VM exit 255 with syntax error, unexpected token "->"…; PHP_COMPILER_PROFILE=8.4 prints 1 exit 0
    • PHPUnit NewDereferenceable / gate filters: OK
    • Compliance new_dereferencable*: OK (4)
    • Spine sync + inventory --check + VM driver probe: OK

    Trust gates (pre-claim)

    • make bootstrap-selfhost-link: green
    • inventory --check: was stale on master; regenerated with this PR’s rejector (now OK on branch)
    • release-readiness --json: was still running north-star5-verify --fast at claim time (not a blocker for this language gate)
  4. PurHur commented on Jul 16, 2026

    @PurHur
    OwnerAuthor

    claim: lane-B compile/link worker — starting this run

  5. PurHur commented on Jul 16, 2026

    @PurHur
    OwnerAuthor

    Withdrawing claim — already merged via #19692 before this worker’s claim comment. Verified on master: default VM rejects with Zend-shaped parse error (exit 255); PHP_COMPILER_PROFILE=8.4 still runs.

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 workingenhancementNew feature or requestimplementation-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