Skip to content

Regression: asymmetric private(set) Error message includes public — Zend omits get-visibility (Zend/zend_object_handlers.c) #21526

Description

@PurHur

Category

Regression · php-src-strict · Error message wording (Pillar 4)

Problem

Writing a public private(set) property from outside scope correctly throws Error, but the message diverges from Zend 8.4.23:

Repro Zend 8.4.23 VM PROFILE=8.4
$a->x = 2 on public private(set) string $x Cannot modify private(set) property A::$x from global scope Cannot modify public private(set) property A::$x from global scope ❌

Unit fixtures currently expect a third wording (public (private(set))), so tests and Zend both disagree with live VM — align to Zend.

Probed 2026-07-20 vs php:8.4-cli (8.4.23).

php-src reference

PHP implementation target

  • Match Zend message text in asymmetric set guards (VM + JIT/AOT); update unit expectations in test/unit/AsymmetricVisibilityJitExecuteTest.php / related; PHP-in-PHP; no new C.

Repro

./script/docker-exec.sh -- bash -lc 'export PHP_COMPILER_PROFILE=8.4
php bin/vm.php -r "
class A { public private(set) string \$x = \"a\"; }
\$a = new A();
try { \$a->x = \"b\"; } catch (Throwable \$e) { echo \$e->getMessage(), PHP_EOL; }
"
# expect: Cannot modify private(set) property A::\$x from global scope
'

Done when

  • Error message matches Zend 8.4.23 exactly (no leading get-visibility token)
  • VM/JIT/AOT + unit tests updated; php-src-strict; no new C

Related

Activity

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:vmVirtual machinebugSomething 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