[php-src] Issue #7862: `spl_object_id` should never reuse an old value
| From: | mvorisek | Date: | Fri, 31 Dec 2021 16:50:55 +0000 |
| Subject: | [php-src] Issue #7862: `spl_object_id` should never reuse an old value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238684@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7862
Comment Author: mvorisek
simple example:
```
class Data {
public function getData(object $obj) {
return $this->data[spl_object_id($obj)];
}
}
```
Currently, lookup by
spl_object_id() must be combined with another condition to check
if the data are really for the given object ID (returned by spl_object_id()) which
requeries:
a) the original object stored
b) or some extra unique ID stored in the given object