mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
This commit is contained in:
commit
6f355c6c79
2 changed files with 40 additions and 2 deletions
|
@ -1128,8 +1128,11 @@ try_string_offset:
|
||||||
dim = Z_REFVAL_P(dim);
|
dim = Z_REFVAL_P(dim);
|
||||||
goto try_string_offset;
|
goto try_string_offset;
|
||||||
default:
|
default:
|
||||||
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim, BP_VAR_IS);
|
zend_illegal_container_offset(ZSTR_KNOWN(ZEND_STR_STRING), dim,
|
||||||
break;
|
EG(current_execute_data)->opline->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ ?
|
||||||
|
BP_VAR_IS : BP_VAR_RW);
|
||||||
|
ZVAL_NULL(result);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = zval_get_long_func(dim, /* is_strict */ false);
|
offset = zval_get_long_func(dim, /* is_strict */ false);
|
||||||
|
|
35
ext/opcache/tests/jit/gh12748.phpt
Normal file
35
ext/opcache/tests/jit/gh12748.phpt
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
--TEST--
|
||||||
|
GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$container = "string";
|
||||||
|
// Is
|
||||||
|
try {
|
||||||
|
echo "isset():\n";
|
||||||
|
var_dump(isset($container[new stdClass()]));
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
echo "empty():\n";
|
||||||
|
var_dump(empty($container[new stdClass()]));
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
echo "Coalesce():\n";
|
||||||
|
var_dump($container[new stdClass()] ?? 'default');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
isset():
|
||||||
|
bool(false)
|
||||||
|
empty():
|
||||||
|
bool(true)
|
||||||
|
Coalesce():
|
||||||
|
Cannot access offset of type stdClass on string
|
Loading…
Add table
Add a link
Reference in a new issue