Skip to content

Commit

Permalink
Use zend_string_equals API in a couple places
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jul 3, 2020
1 parent 2ecc597 commit 344c077
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions ext/opcache/Optimizer/dfa_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
3 changes: 1 addition & 2 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 344c077

Please sign in to comment.