Skip to content

Commit 344c077

Browse files
committed
Use zend_string_equals API in a couple places
1 parent 2ecc597 commit 344c077

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

ext/opcache/Optimizer/dfa_pass.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
372372
if (call_info->caller_call_opline
373373
&& call_info->caller_call_opline->opcode == ZEND_DO_ICALL
374374
&& call_info->callee_func
375-
&& ZSTR_LEN(call_info->callee_func->common.function_name) == sizeof("in_array")-1
376-
&& memcmp(ZSTR_VAL(call_info->callee_func->common.function_name), "in_array", sizeof("in_array")-1) == 0
375+
&& zend_string_equals_literal(call_info->callee_func->common.function_name, "in_array")
377376
&& (call_info->caller_init_opline->extended_value == 2
378377
|| (call_info->caller_init_opline->extended_value == 3
379378
&& (call_info->caller_call_opline - 1)->opcode == ZEND_SEND_VAL

ext/reflection/php_reflection.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6644,8 +6644,7 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
66446644
static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
66456645
{
66466646
if (zend_hash_exists(&object->ce->properties_info, name)
6647-
&& ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
6648-
|| (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
6647+
&& (zend_string_equals_literal(name, "name") || zend_string_equals_literal(name, "class")))
66496648
{
66506649
zend_throw_exception_ex(reflection_exception_ptr, 0,
66516650
"Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));

ext/session/session.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,7 @@ static void php_session_save_current_state(int write) /* {{{ */
471471
if (PS(lazy_write) && PS(session_vars)
472472
&& PS(mod)->s_update_timestamp
473473
&& PS(mod)->s_update_timestamp != php_session_update_timestamp
474-
&& ZSTR_LEN(val) == ZSTR_LEN(PS(session_vars))
475-
&& !memcmp(ZSTR_VAL(val), ZSTR_VAL(PS(session_vars)), ZSTR_LEN(val))
474+
&& zend_string_equals(val, PS(session_vars))
476475
) {
477476
ret = PS(mod)->s_update_timestamp(&PS(mod_data), PS(id), val, PS(gc_maxlifetime));
478477
} else {

sapi/phpdbg/phpdbg_wait.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) {
3434

3535

3636
static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) {
37-
if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) {
37+
if (zend_string_equals_literal(auto_global->name, "GLOBALS")) {
3838
auto_global->armed = 0;
3939
}
4040

0 commit comments

Comments
 (0)