1
0
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:
Xinchen Hui
2018-01-05 12:29:39 +08:00
parent b09a3e5286
commit 1db6c19365
2 changed files with 34 additions and 1 deletions

View File

@@ -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) {

View 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"
}
}