# Proposed fix ??/empty and __isset materialization of properties

- Thread: https://externals.io/message/131068
- Original archive: https://news-web.php.net/php.internals/131068
- Started by Nicolas Grekas on 2026-05-29T20:10:57+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #131068 — Nicolas Grekas — 2026-05-29T20:10:57+00:00

URL: https://externals.io/message/131068#131068

Dear internals,

Following the discussion around the __exists() RFC, PR #22181 [1] isolates
the engine-only piece that was suggested there. The broader __exists()
proposal remains on the table separately; this PR is scoped to just the
sequencing issue.

When `??` or `empty()` triggers `__isset()` on a magic property
and `__isset()` writes into the property table (a pattern used in
userland to lazily initialise a property), the engine currently calls
`__get()` afterwards anyway. That redundant `__get()` is mostly cosmetic,
but it can trip up patterns where `__get()` routes through a parent
that doesn't know about the just-materialised property.

The patch adds a property-table re-check after `__isset()` returns true: if
the property now exists physically, the value is returned directly and
`__get()` is skipped. `isset()` itself is unchanged (it
has never called `__get()`).

This sits between bug-fix and feature, so per the usual process: planning
to merge to master in two weeks unless there are objections.

The PR has already been reviewed by @iluuu1994 and @arnaud-lb.

[1] https://github.com/php/php-src/pull/22181
[2] https://github.com/php/php-src/issues/12695

Cheers,
Nicolas
