[php-src] Issue #8437: WeakMap::offsetExists return false if value is null
| From: | cmb69 | Date: | Tue, 26 Apr 2022 09:18:04 +0000 |
| Subject: | [php-src] Issue #8437: WeakMap::offsetExists return false if value is null | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241247@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8437
Comment Author: cmb69
> Despite the confusing name, the API contract of offsetExists is that it must return false for
> null values. It is the analogue of
__isset() and must match
> isset() semantics.
Ah, right.
> Will other Spl implementations of ArrayAccess, like SplObjectStorage, will change in the future
> according to this?
SplObjectStorage::offsetExists() is an alias of ::contains(), what is
apparently a deliberate design decision:
https://github.com/php/php-src/blob/7ce5e0a8f166142f64edfc2cd1f92c45b9c0b946/ext/spl/spl_observer.c#L459
I think we should clarify the respective note in the manual.
Are there other classes, where ::offsetExists() exhibits this behavior?