mirror of
https://github.com/php/php-src.git
synced 2024-11-28 20:34:29 +08:00
Avoid array duplication
This commit is contained in:
parent
2455ab2a2b
commit
9d31b29705
@ -642,10 +642,12 @@ try_again:
|
||||
switch (Z_TYPE_P(op)) {
|
||||
case IS_ARRAY:
|
||||
{
|
||||
zval tmp;
|
||||
ZVAL_COPY_VALUE(&tmp, op);
|
||||
SEPARATE_ARRAY(&tmp);
|
||||
object_and_properties_init(op, zend_standard_class_def, Z_ARR(tmp));
|
||||
HashTable *ht = Z_ARR_P(op);
|
||||
if (Z_IMMUTABLE_P(op)) {
|
||||
/* TODO: try not to duplicate immutable arrays as well ??? */
|
||||
ht = zend_array_dup(ht);
|
||||
}
|
||||
object_and_properties_init(op, zend_standard_class_def, ht);
|
||||
break;
|
||||
}
|
||||
case IS_OBJECT:
|
||||
|
Loading…
Reference in New Issue
Block a user