From: Dmitry Stogov Date: Tue, 1 Apr 2014 17:19:44 +0000 (+0400) Subject: Avoid unnecessry reallocation X-Git-Tag: POST_PHPNG_MERGE~412^2~182 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ddda2f649f3b13db3f4cfc48710637c823464d1;p=php Avoid unnecessry reallocation --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index be68653eeb..de397b921b 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1015,10 +1015,14 @@ ZEND_FUNCTION(get_object_vars) } if (zend_hash_get_current_key_ex(properties, &key, &num_index, 0, &pos) == HASH_KEY_IS_STRING) { if (zend_check_property_access(zobj, key TSRMLS_CC) == SUCCESS) { - zend_unmangle_property_name_ex(key->val, key->len, &class_name, &prop_name, (int*) &prop_len); /* Not separating references */ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value); - add_assoc_zval_ex(return_value, prop_name, prop_len, value); + if (key->val[0] == 0) { + zend_unmangle_property_name_ex(key->val, key->len, &class_name, &prop_name, (int*) &prop_len); + zend_hash_str_update(Z_ARRVAL_P(return_value), prop_name, prop_len, value); + } else { + zend_hash_update(Z_ARRVAL_P(return_value), key, value); + } } } zend_hash_move_forward_ex(properties, &pos);