diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2018-10-04 13:58:35 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-10-10 10:39:10 +0200 |
commit | 7ec8087f8097955bfc6b97d1a916c6ffc39908f4 (patch) | |
tree | 7f56e3c0030c1135bdc84c1a2f1e26724e2f0f3b /sapi/phpdbg | |
parent | 77c85b3119cc3aacbe2642c974bf88e512abd187 (diff) | |
download | php-git-7ec8087f8097955bfc6b97d1a916c6ffc39908f4.tar.gz |
Introduce get_properties_for() handler
This handler allows getting the object properties for a particular
purpose, such as array casting, serialization, etc.
Diffstat (limited to 'sapi/phpdbg')
-rw-r--r-- | sapi/phpdbg/phpdbg_utils.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 0e403a783b..a9b017ef56 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -660,8 +660,6 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) { int (*element_dump_func)(zval *zv, zend_string *key, zend_ulong num); zend_bool is_ref = 0; - int is_temp; - phpdbg_try_access { is_ref = Z_ISREF_P(zv) && GC_REFCOUNT(Z_COUNTED_P(zv)) > 1; ZVAL_DEREF(zv); @@ -696,10 +694,9 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) { } phpdbg_xml("<array refstatus=\"%s\" num=\"%d\">", COMMON, zend_hash_num_elements(myht)); element_dump_func = phpdbg_xml_array_element_dump; - is_temp = 0; goto head_done; case IS_OBJECT: - myht = Z_OBJDEBUG_P(zv, is_temp); + myht = zend_get_properties_for(zv, ZEND_PROP_PURPOSE_DEBUG); if (myht && GC_IS_RECURSIVE(myht)) { phpdbg_xml("<recursion />"); break; @@ -717,9 +714,8 @@ head_done: } ZEND_HASH_FOREACH_END(); zend_hash_apply_with_arguments(myht, (apply_func_args_t) element_dump_func, 0); GC_UNPROTECT_RECURSION(myht); - if (is_temp) { - zend_hash_destroy(myht); - efree(myht); + if (Z_TYPE_P(zv) == IS_OBJECT) { + zend_release_properties(myht); } } if (Z_TYPE_P(zv) == IS_ARRAY) { |