diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-07-18 14:49:00 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-07-18 14:49:00 +0300 |
commit | 412dd75e057e773e3eeeaeb77a14da655cbd4779 (patch) | |
tree | 917741b418383ee3bed8909d37bc399b8faad56c | |
parent | 583616deb141c4c56f94bc3bac454725a538cb50 (diff) | |
download | php-git-412dd75e057e773e3eeeaeb77a14da655cbd4779.tar.gz |
Perform checks for propertis started with '\\0' only for dynamic properties
-rw-r--r-- | Zend/zend_object_handlers.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index c299f5ed48..7889f523ee 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -364,13 +364,6 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c return (uintptr_t)CACHED_PTR_EX(cache_slot + 1); } - if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) { - if (!silent) { - zend_throw_error(NULL, "Cannot access property started with '\\0'"); - } - return ZEND_WRONG_PROPERTY_OFFSET; - } - if (UNEXPECTED(zend_hash_num_elements(&ce->properties_info) == 0)) { goto exit_dynamic; } @@ -418,6 +411,12 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c } } else if (UNEXPECTED(property_info == NULL)) { exit_dynamic: + if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) { + if (!silent) { + zend_throw_error(NULL, "Cannot access property started with '\\0'"); + } + return ZEND_WRONG_PROPERTY_OFFSET; + } if (cache_slot) { CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET); } @@ -445,13 +444,6 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s uint32_t flags; zend_class_entry *scope; - if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) { - if (!silent) { - zend_throw_error(NULL, "Cannot access property started with '\\0'"); - } - return ZEND_WRONG_PROPERTY_INFO; - } - if (UNEXPECTED(zend_hash_num_elements(&ce->properties_info) == 0)) { goto exit_dynamic; } @@ -495,6 +487,12 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s property_info = (zend_property_info*)Z_PTR_P(zv); } else if (UNEXPECTED(property_info == NULL)) { exit_dynamic: + if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0' && ZSTR_LEN(member) != 0)) { + if (!silent) { + zend_throw_error(NULL, "Cannot access property started with '\\0'"); + } + return ZEND_WRONG_PROPERTY_INFO; + } return NULL; } else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) { /* Information was available, but we were denied access. Error out. */ |