Skip to content

Regression: typed class constants parse on default 8.2 profile — Zend parse error (re-#22705, Zend/zend_compile.c) #22782

Closed

Description

@PurHur

Category

Regression: · php-src-strict · profile gate (re-#22705 / re-#15769)

Problem

public const string X = ... is PHP 8.3+. Zend 8.2 parse-errors; default-profile VM still accepts and evaluates (rebroken after #22705 closed 2026-07-24).

Repro Zend 8.2.32 VM (2026-07-24, default)
class A { public const string X = \"hi\"; } echo A::X; Parse error: unexpected identifier \"X\" prints hi

Observed master@0ae5abab2.

php-src reference

PHP implementation target

  • Profile gate in lib/ parser/compile — parse-error typed class consts unless profile ≥ 8.3
  • PHP-in-PHP only; no new runtime/*.c logic

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/typed_const_profile.php <<\"PHP\"
<?php
class A { public const string X = \"hi\"; }
echo A::X, PHP_EOL;
PHP
php /tmp/typed_const_profile.php; echo EXIT_ZEND:$?
php bin/vm.php /tmp/typed_const_profile.php; echo EXIT_VM:$?'

Done when

  • Default 8.2 profile: Zend-shaped parse error; no hi output
  • PHP_COMPILER_PROFILE=8.3 or 8.4: prints hi
  • Repro/compliance guard; php-src-strict

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