mirror of
https://github.com/php/php-src.git
synced 2025-01-26 21:54:16 +08:00
Fixed SCCP on PHI(partial_object#1, partial_object#2)
This commit is contained in:
parent
8a7ba133c3
commit
7c9556db99
@ -144,16 +144,16 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* PARTIAL_ARRAY is lower than IS_ARRAY */
|
||||
if (Z_TYPE_P(value) == IS_ARRAY && IS_PARTIAL_ARRAY(new)) {
|
||||
/* Always replace PARTIAL_(ARRAY|OBJECT), as new maybe changed by join_partial_(arrays|object) */
|
||||
if (IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new)) {
|
||||
zval_ptr_dtor_nogc(value);
|
||||
ZVAL_COPY(value, new);
|
||||
scdf_add_to_worklist(scdf, var);
|
||||
/*?? scdf_add_to_worklist(scdf, var); */
|
||||
return;
|
||||
}
|
||||
|
||||
#if ZEND_DEBUG
|
||||
ZEND_ASSERT(IS_PARTIAL_ARRAY(new) || IS_PARTIAL_OBJECT(new) || zend_is_identical(value, new));
|
||||
ZEND_ASSERT(zend_is_identical(value, new));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
22
ext/opcache/tests/opt/sccp_014.phpt
Normal file
22
ext/opcache/tests/opt/sccp_014.phpt
Normal file
@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
SCCP 013: Conditional Constant Propagation of non-escaping object properties on PHI
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.optimization_level=-1
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function loadEntities($entity_information) {
|
||||
$entity_types = new StdClass();
|
||||
$entity_types->a = 1;
|
||||
foreach ($entity_information as $info) {
|
||||
$entity_types->a = 0;
|
||||
}
|
||||
var_dump((bool)($entity_types->a));
|
||||
}
|
||||
|
||||
loadEntities(array("first", "second"));
|
||||
--EXPECT--
|
||||
bool(false)
|
Loading…
Reference in New Issue
Block a user