[php-src] PR #24665: JIT: Fix JIT ASSIGN_DIM undefined OP_DATA and dim reporting on non-array containers
| From: | jorgsowa | Date: | Sat, 24 Oct 2026 22:25:02 +0000 |
| Subject: | [php-src] PR #24665: JIT: Fix JIT ASSIGN_DIM undefined OP_DATA and dim reporting on non-array containers | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39845@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24665
Author: jorgsowa
In function JIT,
zend_jit_assign_dim_helper() read an undefined OP_DATA before checking
the container type. The VM reads it only when it actually assigns, so the JIT reported warnings in a
different order, or where the VM reports none:
| Code | VM | Function
JIT |
|-------------------------------|------------------------------------------------------|----------------------------------------------------|
| $x = 1.5; $x[0] = $undef; | Error: Cannot use a scalar value as an
array | extra Undefined variable warning before the Error |
| $x = 'ab'; $x[] = $undef; | Error: [] operator not supported for
strings | extra Undefined variable warning before the Error |
| $x = false; $x[0] = $undef; | Deprecated (false to array), then Undefined variable |
Undefined variable, then Deprecated |
| $x = 1.5; $x[$undef] = 1; | Error: Cannot use a scalar value as an
array | extra Undefined variable warning before the Error |
The helper now checks for an undefined value only on the false path, after the
deprecation, and no longer reports an undefined key on the scalar path. The generated JIT code is
unchanged, and the helper is slightly smaller at -O2 (183 instructions instead of 207
on arm64).