summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-03 17:00:58 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-03 17:02:28 +0200
commit344c0774008c83b2a629c464116952bfe51e062b (patch)
tree3b82a299689e9d412f8c6410f0ad5bdbde76db03
parent2ecc597259ffd564f4e644b540cd9ad0e548c35a (diff)
downloadphp-git-344c0774008c83b2a629c464116952bfe51e062b.tar.gz
Use zend_string_equals API in a couple places
-rw-r--r--ext/opcache/Optimizer/dfa_pass.c3
-rw-r--r--ext/reflection/php_reflection.c3
-rw-r--r--ext/session/session.c3
-rw-r--r--sapi/phpdbg/phpdbg_wait.c2
4 files changed, 4 insertions, 7 deletions
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index 033f2df2c0..a8bff00557 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -372,8 +372,7 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
if (call_info->caller_call_opline
&& call_info->caller_call_opline->opcode == ZEND_DO_ICALL
&& call_info->callee_func
- && ZSTR_LEN(call_info->callee_func->common.function_name) == sizeof("in_array")-1
- && memcmp(ZSTR_VAL(call_info->callee_func->common.function_name), "in_array", sizeof("in_array")-1) == 0
+ && zend_string_equals_literal(call_info->callee_func->common.function_name, "in_array")
&& (call_info->caller_init_opline->extended_value == 2
|| (call_info->caller_init_opline->extended_value == 3
&& (call_info->caller_call_opline - 1)->opcode == ZEND_SEND_VAL
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 33aeddde89..e5ce3cf88d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -6644,8 +6644,7 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
if (zend_hash_exists(&object->ce->properties_info, name)
- && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
- || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
+ && (zend_string_equals_literal(name, "name") || zend_string_equals_literal(name, "class")))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));
diff --git a/ext/session/session.c b/ext/session/session.c
index 0b190f0496..ed31912382 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -471,8 +471,7 @@ static void php_session_save_current_state(int write) /* {{{ */
if (PS(lazy_write) && PS(session_vars)
&& PS(mod)->s_update_timestamp
&& PS(mod)->s_update_timestamp != php_session_update_timestamp
- && ZSTR_LEN(val) == ZSTR_LEN(PS(session_vars))
- && !memcmp(ZSTR_VAL(val), ZSTR_VAL(PS(session_vars)), ZSTR_LEN(val))
+ && zend_string_equals(val, PS(session_vars))
) {
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
} else {
diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c
index db493ccf30..ec78f18db7 100644
--- a/sapi/phpdbg/phpdbg_wait.c
+++ b/sapi/phpdbg/phpdbg_wait.c
@@ -34,7 +34,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) {
static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) {
- if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) {
+ if (zend_string_equals_literal(auto_global->name, "GLOBALS")) {
auto_global->armed = 0;
}