com php-src: Perform checks for propertis started with '\\0' only for dynamic properties: Zend/zend_object_handlers.c
| From: | Dmitry Stogov | Date: | Wed, 18 Jul 2018 11:49:00 +0000 |
| Subject: | com php-src: Perform checks for propertis started with '\\0' only for dynamic properties: Zend/zend_object_handlers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102599@lists.php.net to get a copy of this message | ||
Commit: 412dd75e057e773e3eeeaeb77a14da655cbd4779
Author: Dmitry Stogov <dmitry@zend.com> Wed, 18 Jul 2018 14:49:00 +0300
Parents: 583616deb141c4c56f94bc3bac454725a538cb50
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=412dd75e057e773e3eeeaeb77a14da655cbd4779
Log:
Perform checks for propertis started with '\\0' only for dynamic properties
Changed paths:
M Zend/zend_object_handlers.c
Diff:
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index c299f5e..7889f52 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. */