Skip to content

Parity: dynamic property creation should emit E_DEPRECATED in PHP 8.2 #14839

Closed

Description

@PurHur

Repro

class C {}
$c = new C;
$c->x = 1;
echo "ok\n";

Run Zend with error_reporting=E_ALL / display_errors=1.

Expected (php-src / PHP 8.2)

Emits a deprecation notice on first creation:

Deprecated: Creation of dynamic property C::$x is deprecated

Actual (php-compiler)

No deprecation notice is emitted.

Notes / reference

php-src implements the notice in:

  • Zend/zend_object_handlers.c: zend_deprecated_dynamic_property() and the write_std_property dynamic-property path.

(See also RFC: “Deprecate dynamic properties”, implemented for PHP 8.2.)

Test plan

  • Add a compliance case asserting the E_DEPRECATED text for a non-#[AllowDynamicProperties] class.
  • Ensure stdClass remains exempt.

Activity

  1. added
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 2, 2026
  2. PurHur commented on Jul 2, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent — batch (issues #14839)

  3. PurHur commented on Jul 2, 2026

    @PurHur
    OwnerAuthor

    Merged via #14840.

    Root cause: VM/JIT dynamic-property deprecation was already implemented (fetchObjectPropertyWriteLvalue, DynamicPropertyDeprecationGuard); the compliance phpt EXPECTF omitted the CLI file/line suffix.

    Verification:

    • `php bin/vm.php -d error_reporting=E_ALL -r 'class C {} $c = new C; $c->x = 1; echo "ok\n";'` → emits `Creation of dynamic property C::$x is deprecated`
    • `DynamicPropertyDeprecationVMTest`, `DynamicPropertyDeprecatedJITTest`, `DynamicPropertyDeprecationCliTest` — all green
    • `stdClass` / `#[AllowDynamicProperties]` remain exempt
  4. PurHur commented on Jul 2, 2026

    @PurHur
    OwnerAuthor

    claim released: cursor-agent — issue already closed/merged; lane B worker had no remaining batch items.

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 machineimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions