Skip to content

Language: creating dynamic property silent — Zend E_DEPRECATED (re-#21953, zend_object_handlers.c) #29195

Closed

Description

@PurHur

Category

language · php-src-strict · PHP 8.2 dynamic properties · pillar 4

Problem

On Zend/php-src 8.2+, writing an undeclared property on a class without #[AllowDynamicProperties] emits E_DEPRECATED (Creation of dynamic property … is deprecated) and still performs the write.

On tip 7ea033c479, VM and JIT perform the write silently (no deprecation) under PHP_COMPILER_PROFILE=8.2.

Repro Zend 8.2.30 VM/JIT PROFILE=8.2 (7ea033c479)
class A {} then $a->x = 1 Deprecated: Creation of dynamic property A::$x is deprecated + 1 1 only
<?php
class A {}
$a = new A();
$a->x = 1;
echo $a->x, "\n";

Controls that already match Zend on this tip: #[AllowDynamicProperties] suppresses the notice; stdClass stays silent.

php-src reference

PHP implementation target

  • Shared write-property path in lib/VM + JIT lowering: emit E_DEPRECATED when profile ≥ 8.2, class lacks AllowDynamicProperties, and property is not declared
  • PHP-in-PHP; no new C

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.2 php bin/vm.php test/repro/maintainer_probe_dynamic_prop_deprecation.php'
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.2 php bin/jit.php test/repro/maintainer_probe_dynamic_prop_deprecation.php'
docker run --rm -i php:8.2-cli php < test/repro/maintainer_probe_dynamic_prop_deprecation.php

Done when

  • VM + JIT PROFILE≥8.2 emit Zend-matching E_DEPRECATED then write
  • #[AllowDynamicProperties] / stdClass remain silent
  • PROFILE<8.2 stays silent like Zend 8.1
  • Guard under test/repro/ or compliance; php-src-strict

Activity

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

    @PurHur
    OwnerAuthor

    claim: worker-lane-C — starting this run

    Gate snapshot before work:

  3. PurHur commented on Aug 9, 2026

    @PurHur
    OwnerAuthor

    Merged #29198

    Verification

    • PHP_COMPILER_PROFILE=8.2 VM + JIT: Creation of dynamic property A::$x is deprecated then 1 / AllowDynamicProperties + stdClass silent
    • PHP_COMPILER_PROFILE=8.1: silent (Zend 8.1)
    • PHPUnit: EAllProfileValueTest, DynamicPropertyDeprecationCliTest, DynamicPropertyDeprecationVMTest, DynamicPropertyDeprecatedJITTest — OK

    Root cause: explicit PROFILE≤8.3 used the #4842 22527 guest startup mask (no E_DEPRECATED); Zend 8.2+ php.ini is E_ALL.

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

    IMPORTANTCritical patharea:compilerCompiler / CFG / JITarea: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