[php-src] PR #19309: Prevent operands from being released during comparison
| From: | arnaud-lb | Date: | Wed, 30 Jul 2025 13:19:02 +0000 |
| Subject: | [php-src] PR #19309: Prevent operands from being released during comparison | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32703@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19309
Author: arnaud-lb
Prevent operands from being released during comparison:
``` php
$a = [
'foo' => 'test',
'bar' => 2,
];
$b = [
'foo' => new class {
public function __toString() {
global $a, $b;
$a = $b = null;
return '';
}
},
'bar' => 2,
];
// Comparison of $a['foo'] and $b['foo'] calls __toString(), which releases
// both $a and $b.
var_dump($a > $b);
```
Fixes GH-19305