mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix type inference
This commit is contained in:
commit
2495459e50
2 changed files with 19 additions and 2 deletions
|
@ -3277,10 +3277,11 @@ static zend_always_inline zend_result _zend_update_type_info(
|
|||
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
|
||||
}
|
||||
}
|
||||
if (opline->opcode == ZEND_FETCH_DIM_RW
|
||||
if ((key_type & (MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_KEY_STRING))
|
||||
&& (opline->opcode == ZEND_FETCH_DIM_RW
|
||||
|| opline->opcode == ZEND_FETCH_DIM_W
|
||||
|| opline->opcode == ZEND_FETCH_DIM_FUNC_ARG
|
||||
|| opline->opcode == ZEND_FETCH_LIST_W) {
|
||||
|| opline->opcode == ZEND_FETCH_LIST_W)) {
|
||||
j = ssa_vars[ssa_op->result_def].use_chain;
|
||||
if (j < 0) {
|
||||
/* no uses */
|
||||
|
|
16
ext/opcache/tests/opt/inference_006.phpt
Normal file
16
ext/opcache/tests/opt/inference_006.phpt
Normal file
|
@ -0,0 +1,16 @@
|
|||
--TEST--
|
||||
Type inference 006: FETCH_DIM_W with invalid key type
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--FILE--
|
||||
<?php
|
||||
function y() {
|
||||
$obj=new y;
|
||||
u($y[$obj]);
|
||||
}
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
Loading…
Add table
Add a link
Reference in a new issue