[php-src] PR #21674: Fix GH-17144: type inference narrowing on ZEND_FETCH_DIM_W
| From: | iliaal | Date: | Wed, 08 Apr 2026 11:16:18 +0000 |
| Subject: | [php-src] PR #21674: Fix GH-17144: type inference narrowing on ZEND_FETCH_DIM_W | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35619@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21674
Author: iliaal
## Summary
FETCH_DIM_W stripped MAY_BE_ARRAY_EMPTY only inside a block guarded by
key_type & (MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING). When the key
operand's type widened across loop iterations (e.g. from MAY_BE_ARRAY to include
scalar types), key_type went from 0 to non-zero, causing the flag to be stripped on the
second pass but not the first. This violated monotonicity and triggered the narrowing assertion.
Strips MAY_BE_ARRAY_EMPTY for write opcodes (W, RW, LIST_W) regardless of
key_type, since a dimension write makes the array non-empty.
Fixes #17144