diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-03-20 11:37:42 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-03-20 11:37:42 +0400 |
commit | 07fcdc40a0f2af388cff2b6083149a0dd8584003 (patch) | |
tree | af4a8351406db1534c0edcd6da2a5c2b7de54d69 /Zend/zend_variables.c | |
parent | e4e75025488630ff5aa567b521e806af455345d3 (diff) | |
download | php-git-07fcdc40a0f2af388cff2b6083149a0dd8584003.tar.gz |
Fixed circular array copying
Diffstat (limited to 'Zend/zend_variables.c')
-rw-r--r-- | Zend/zend_variables.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 20f8b1adb6..6d5b70ed45 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -243,15 +243,16 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) break; case IS_ARRAY: case IS_CONSTANT_ARRAY: { - HashTable *ht = Z_ARRVAL_P(zvalue); + zval new_arr; TSRMLS_FETCH(); - if (ht == &EG(symbol_table).ht) { + if (Z_ARR_P(zvalue) == &EG(symbol_table)) { return; /* do nothing */ } - ZVAL_NEW_ARR(zvalue); - zend_hash_init(Z_ARRVAL_P(zvalue), zend_hash_num_elements(ht), NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(Z_ARRVAL_P(zvalue), ht, zval_add_ref); + ZVAL_NEW_ARR(&new_arr); + zend_hash_init(Z_ARRVAL(new_arr), zend_hash_num_elements(Z_ARRVAL_P(zvalue)), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(Z_ARRVAL(new_arr), Z_ARRVAL_P(zvalue), zval_add_ref); + ZVAL_COPY_VALUE(zvalue, &new_arr); } break; case IS_CONSTANT_AST: { |