mirror of
https://github.com/php/php-src.git
synced 2026-03-29 11:42:17 +02:00
Fixed wrongly const replacing on partial array
This commit is contained in:
@@ -1249,8 +1249,10 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
|
||||
if (result) {
|
||||
ZVAL_COPY_VALUE(&zv, result);
|
||||
ZVAL_NULL(result);
|
||||
} else {
|
||||
} else if (op1 && !IS_PARTIAL_ARRAY(op1)) {
|
||||
array_init(&zv);
|
||||
} else {
|
||||
empty_partial_array(&zv);
|
||||
}
|
||||
|
||||
if (op1) {
|
||||
|
||||
31
ext/opcache/tests/opt/sccp_023.phpt
Normal file
31
ext/opcache/tests/opt/sccp_023.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
SCCP 023: ADD_ARRAY_ELEMENT with partial array
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=0
|
||||
opcache.opt_debug_level=0
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function a ($field_type, $allowed_values) {
|
||||
$settings = [
|
||||
'list_string' => [
|
||||
'allowed_values' => $allowed_values,
|
||||
],
|
||||
];
|
||||
|
||||
return $settings[$field_type];
|
||||
}
|
||||
|
||||
var_dump(a("list_string", ["xxx"]));
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["allowed_values"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(3) "xxx"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user