Skip to content

WeakMap::offsetExists(): document that null values return false - #5962

Merged
lacatoire merged 1 commit into
php:masterfrom
qodelicious:weakmap-offsetexists-null
Oct 19, 2026
Merged

lacatoire merged 1 commit into
php:masterfrom
qodelicious:weakmap-offsetexists-null

Conversation

@qodelicious

Copy link
Copy Markdown
Contributor

Adds a note that offsetExists() behaves like isset() and returns false when the stored value is null, even though the object is still in the map (see php/php-src#8437).

Checked with PHP 8.4: after $map[$obj] = null, offsetExists($obj) is false while count($map) is 1.

Fixes #4727

@lacatoire
lacatoire merged commit 069aa70 into php:master Oct 19, 2026
3 checks passed
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.

Add note for WeakMap::offsetExists behavoir for NULL values

2 participants