diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-07 16:10:19 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-07 16:10:19 +0200 |
commit | 425c6f5815ea8ffbf5b73d684bd931551c200d26 (patch) | |
tree | b196e3ebbade53ce0c732b3070b50acae981d54f /ext/reflection/php_reflection.c | |
parent | c81cf1c7af886161628ac4360cb5e5bfd94500fd (diff) | |
download | php-git-425c6f5815ea8ffbf5b73d684bd931551c200d26.tar.gz |
Optimize internal name fetching in reflection
Directly fetch the name property, instead of construction the
properties hash table and performing a lookup in it. This is both
slow and wastes a lot of memory.
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e9993e9feb..82b1b3d68c 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -172,7 +172,11 @@ static inline zend_bool is_closure_invoke(zend_class_entry *ce, zend_string *lcn static zval *_default_load_name(zval *object) /* {{{ */ { - return zend_hash_find_ex_ind(Z_OBJPROP_P(object), ZSTR_KNOWN(ZEND_STR_NAME), 1); + zval *name = reflection_prop_name(object); + if (Z_ISUNDEF_P(name)) { + return NULL; + } + return name; } /* }}} */ |