summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_compile.c13
-rw-r--r--Zend/zend_string.h3
2 files changed, 6 insertions, 10 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index ca0b242e14..92b26b2001 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3051,14 +3051,11 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
uint32_t zend_get_class_fetch_type(zend_string *name) /* {{{ */
{
- if (name->len == sizeof("self") - 1 &&
- !strncasecmp(name->val, "self", sizeof("self") - 1)) {
+ if (zend_string_equals_literal_ci(name, "self")) {
return ZEND_FETCH_CLASS_SELF;
- } else if (name->len == sizeof("parent") - 1 &&
- !strncasecmp(name->val, "parent", sizeof("parent") - 1)) {
+ } else if (zend_string_equals_literal_ci(name, "parent")) {
return ZEND_FETCH_CLASS_PARENT;
- } else if (name->len == sizeof("static") - 1 &&
- !strncasecmp(name->val, "static", sizeof("static") - 1)) {
+ } else if (zend_string_equals_literal_ci(name, "static")) {
return ZEND_FETCH_CLASS_STATIC;
} else {
return ZEND_FETCH_CLASS_DEFAULT;
@@ -3253,10 +3250,6 @@ static inline zend_bool zend_string_equals_str_ci(zend_string *str1, zend_string
}
/* }}} */
-#define zend_string_equals_literal_ci(str, c) \
- ((str)->len == sizeof(c) - 1 \
- && !zend_binary_strcasecmp((str)->val, (str)->len, (c), sizeof(c) - 1))
-
static void zend_adjust_for_fetch_type(zend_op *opline, uint32_t type) /* {{{ */
{
switch (type & BP_VAR_MASK) {
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index 479e92069e..a2b5fb932e 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -214,6 +214,9 @@ static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_str
return s1 == s2 || (s1->len == s2->len && !memcmp(s1->val, s2->val, s1->len));
}
+#define zend_string_equals_literal_ci(str, c) \
+ ((str)->len == sizeof(c) - 1 && !zend_binary_strcasecmp((str)->val, (str)->len, (c), sizeof(c) - 1))
+
#define zend_string_equals_literal(str, literal) \
((str)->len == sizeof(literal)-1 && !memcmp((str)->val, literal, sizeof(literal) - 1))