[php-src] PR #25436: SCCP: Fold array_key_exists() with boolean and integral float keys
| From: | LamentXU123 | Date: | Fri, 13 Nov 2026 05:05:54 +0000 |
| Subject: | [php-src] PR #25436: SCCP: Fold array_key_exists() with boolean and integral float keys | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40609@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25436
Author: LamentXU123
We can remove the extra key-type restriction in ct_eval_array_key_exists() to allow SCCP to fold
calls with boolean and integral float keys
This is safe because fetch_array_elem()
https://github.com/php/php-src/blob/d1ec606d13d4ca2f17a433de0d47e1c4342eefd0/Zend/Optimizer/sccp.c#L361-L388
already implements the required conversions.
for example:
```
function test() {
return array_key_exists(1.0, [1 => null]);
}
```
before
```
0000 T0 = ARRAY_KEY_EXISTS float(1) array(...)
0001 RETURN T0
```
after
```
0000 RETURN bool(true)
```