/* 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); */
+ if (Z_TYPE_P(value) != Z_TYPE_P(new)
+ || zend_hash_num_elements(Z_ARR_P(new)) != zend_hash_num_elements(Z_ARR_P(value))) {
+ zval_ptr_dtor_nogc(value);
+ ZVAL_COPY(value, new);
+ scdf_add_to_worklist(scdf, var);
+ }
return;
}
}
loadEntities(array("first", "second"));
+?>
--EXPECT--
bool(true)
}
loadEntities(array("first", "second"));
+?>
--EXPECT--
bool(false)
--- /dev/null
+--TEST--
+SCCP 013: Conditional Constant Propagation of non-escaping object properties on PHI and Rewinding
+--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->b = 0;
+ foreach ($entity_information as $ex) {
+ var_dump((bool)$entity_types->b);
+ foreach ($entity_information as $info) {
+ $entity_types->b = 1;
+ }
+ }
+}
+
+loadEntities(array("first", "second"));
+?>
+--EXPECT--
+bool(false)
+bool(true)