Skip to content

Language: inaccessible isset/unset via __isset/__unset (#25668) - #25705

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-25668-isset-unset-inaccessible
Jul 31, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-25668-isset-unset-inaccessible

Conversation

@PurHur

@PurHur PurHur commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Outside-scope isset/empty on declared private/protected props no longer reads the real slot; they dispatch __isset (or return false) per zend_std_has_property.
  • Outside-scope unset dispatches __unset without clearing the private slot; without magic it throws Cannot access private/protected property …. Parent-private from a child stays a silent no-op (or __unset).
  • Compliance: magic_isset_inaccessible.phpt, magic_unset_inaccessible.phpt.

Closes #25668

php-src reference

  • Zend/zend_object_handlers.c — zend_std_has_property, zend_std_unset_property

PHP implementation

  • lib/VM.php — objectPropertyIsSet, dispatchInaccessibleDeclaredPropertyUnset (+ shared declaredPropertyInaccessibleFromCaller)

Test plan

  • Issue repro (VM matches Zend)
  • vendor/bin/phpunit --filter 'magic_isset|magic_unset' test/compliance → OK (12 tests, VM+JIT)

Verification transcript

=== ISSUE REPRO VM ===
ISSET_x
true
UNSET_x

=== unset without magic ===
out unset x: Cannot access private property A::$x
out unset y: Cannot access protected property A::$y
… after magic unset value=1

PHPUnit: OK (12 tests, 12 assertions)

Gates noted (master baseline)

  • north-star5-verify --fast / inventory / VM probe: green
  • release-readiness: user_release_ready: no — helper-runtime prelink stale (unrelated)

Made with Cursor

)

Declared private/protected slots were treated as present for isset/empty/unset
from outside scope, skipping magic and leaking or clearing the real property.
Match zend_std_has_property / zend_std_unset_property: overload or Error, keep
in-scope and parent-private-from-child behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit af6f905 into master Jul 31, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-25668-isset-unset-inaccessible branch July 31, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: isset/unset on inaccessible private props skip __isset/__unset (re-#3298, zend_object_handlers.c)

1 participant