Skip to content

Commit d5ad751

Browse files
authored
More usage of known zend_str instead of C string (#11381)
1 parent 962a777 commit d5ad751

38 files changed

+110
-103
lines changed

Zend/zend_API.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3529,7 +3529,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
35293529
*strict_class = 1;
35303530
ret = 1;
35313531
}
3532-
} else if (zend_string_equals_literal(lcname, "static")) {
3532+
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_STATIC))) {
35333533
zend_class_entry *called_scope = zend_get_called_scope(frame);
35343534

35353535
if (!called_scope) {
@@ -4560,7 +4560,7 @@ ZEND_API zend_class_constant *zend_declare_typed_class_constant(zend_class_entry
45604560
}
45614561
}
45624562

4563-
if (zend_string_equals_literal_ci(name, "class")) {
4563+
if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_CLASS))) {
45644564
zend_error_noreturn(ce->type == ZEND_INTERNAL_CLASS ? E_CORE_ERROR : E_COMPILE_ERROR,
45654565
"A class constant must not be called 'class'; it is reserved for class name fetching");
45664566
}

Zend/zend_ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_constant(zend_string *name, ze
101101

102102
ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_class_const_or_name(zend_ast *class_name, zend_ast *name) {
103103
zend_string *name_str = zend_ast_get_str(name);
104-
if (zend_string_equals_literal_ci(name_str, "class")) {
104+
if (zend_string_equals_ci(name_str, ZSTR_KNOWN(ZEND_STR_CLASS))) {
105105
zend_string_release(name_str);
106106
return zend_ast_create(ZEND_AST_CLASS_NAME, class_name);
107107
} else {

Zend/zend_attributes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ZEND_METHOD(SensitiveParameterValue, __construct)
114114
Z_PARAM_ZVAL(value)
115115
ZEND_PARSE_PARAMETERS_END();
116116

117-
zend_update_property(zend_ce_sensitive_parameter_value, Z_OBJ_P(ZEND_THIS), "value", strlen("value"), value);
117+
zend_update_property_ex(zend_ce_sensitive_parameter_value, Z_OBJ_P(ZEND_THIS), ZSTR_KNOWN(ZEND_STR_VALUE), value);
118118
}
119119

120120
ZEND_METHOD(SensitiveParameterValue, getValue)

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ ZEND_FUNCTION(get_defined_functions)
13221322
} ZEND_HASH_FOREACH_END();
13231323

13241324
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
1325-
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
1325+
zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_USER), &user);
13261326
}
13271327
/* }}} */
13281328

Zend/zend_compile.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type) {
14291429
}
14301430

14311431
static bool is_generator_compatible_class_type(zend_string *name) {
1432-
return zend_string_equals_literal_ci(name, "Traversable")
1432+
return zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_TRAVERSABLE))
14331433
|| zend_string_equals_literal_ci(name, "Iterator")
14341434
|| zend_string_equals_literal_ci(name, "Generator");
14351435
}
@@ -1617,7 +1617,7 @@ uint32_t zend_get_class_fetch_type(const zend_string *name) /* {{{ */
16171617
return ZEND_FETCH_CLASS_SELF;
16181618
} else if (zend_string_equals_literal_ci(name, "parent")) {
16191619
return ZEND_FETCH_CLASS_PARENT;
1620-
} else if (zend_string_equals_literal_ci(name, "static")) {
1620+
} else if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
16211621
return ZEND_FETCH_CLASS_STATIC;
16221622
} else {
16231623
return ZEND_FETCH_CLASS_DEFAULT;
@@ -2821,7 +2821,7 @@ static bool is_this_fetch(zend_ast *ast) /* {{{ */
28212821
{
28222822
if (ast->kind == ZEND_AST_VAR && ast->child[0]->kind == ZEND_AST_ZVAL) {
28232823
zval *name = zend_ast_get_zval(ast->child[0]);
2824-
return Z_TYPE_P(name) == IS_STRING && zend_string_equals_literal(Z_STR_P(name), "this");
2824+
return Z_TYPE_P(name) == IS_STRING && zend_string_equals(Z_STR_P(name), ZSTR_KNOWN(ZEND_STR_THIS));
28252825
}
28262826

28272827
return 0;
@@ -4522,7 +4522,7 @@ static zend_result zend_try_compile_special_func(znode *result, zend_string *lcn
45224522
return zend_compile_func_cuf(result, args, lcname);
45234523
} else if (zend_string_equals_literal(lcname, "in_array")) {
45244524
return zend_compile_func_in_array(result, args);
4525-
} else if (zend_string_equals_literal(lcname, "count")
4525+
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_COUNT))
45264526
|| zend_string_equals_literal(lcname, "sizeof")) {
45274527
return zend_compile_func_count(result, args, lcname);
45284528
} else if (zend_string_equals_literal(lcname, "get_class")) {
@@ -4872,7 +4872,7 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u
48724872

48734873
value = zend_hash_update(CG(active_op_array)->static_variables, var_name, value);
48744874

4875-
if (zend_string_equals_literal(var_name, "this")) {
4875+
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
48764876
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as static variable");
48774877
}
48784878

@@ -4888,7 +4888,7 @@ static void zend_compile_static_var(zend_ast *ast) /* {{{ */
48884888
zend_ast *var_ast = ast->child[0];
48894889
zend_string *var_name = zend_ast_get_str(var_ast);
48904890

4891-
if (zend_string_equals_literal(var_name, "this")) {
4891+
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
48924892
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as static variable");
48934893
}
48944894

@@ -6089,7 +6089,7 @@ static void zend_compile_try(zend_ast *ast) /* {{{ */
60896089
zend_resolve_class_name_ast(class_ast));
60906090
opline->extended_value = zend_alloc_cache_slot();
60916091

6092-
if (var_name && zend_string_equals_literal(var_name, "this")) {
6092+
if (var_name && zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
60936093
zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this");
60946094
}
60956095

@@ -6925,7 +6925,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
69256925
if (EX_VAR_TO_NUM(var_node.u.op.var) != i) {
69266926
zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s",
69276927
ZSTR_VAL(name));
6928-
} else if (zend_string_equals_literal(name, "this")) {
6928+
} else if (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS))) {
69296929
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as parameter");
69306930
}
69316931

@@ -7152,7 +7152,7 @@ static void zend_compile_closure_binding(znode *closure, zend_op_array *op_array
71527152
zend_op *opline;
71537153
zval *value;
71547154

7155-
if (zend_string_equals_literal(var_name, "this")) {
7155+
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
71567156
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable");
71577157
}
71587158

@@ -7196,7 +7196,7 @@ static void find_implicit_binds_recursively(closure_info *info, zend_ast *ast) {
71967196
return;
71977197
}
71987198

7199-
if (zend_string_equals_literal(name, "this")) {
7199+
if (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS))) {
72007200
/* $this does not need to be explicitly imported. */
72017201
return;
72027202
}

Zend/zend_constants.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *
314314
} else {
315315
ce = scope->parent;
316316
}
317-
} else if (zend_string_equals_literal_ci(class_name, "static")) {
317+
} else if (zend_string_equals_ci(class_name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
318318
ce = zend_get_called_scope(EG(current_execute_data));
319319
if (UNEXPECTED(!ce)) {
320320
zend_throw_error(NULL, "Cannot access \"static\" when no class scope is active");
@@ -419,7 +419,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
419419
} else {
420420
ce = scope->parent;
421421
}
422-
} else if (zend_string_equals_literal_ci(class_name, "static")) {
422+
} else if (zend_string_equals_ci(class_name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
423423
ce = zend_get_called_scope(EG(current_execute_data));
424424
if (UNEXPECTED(!ce)) {
425425
zend_throw_error(NULL, "Cannot access \"static\" when no class scope is active");

Zend/zend_enum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ static void zend_verify_enum_properties(zend_class_entry *ce)
6262
zend_property_info *property_info;
6363

6464
ZEND_HASH_MAP_FOREACH_PTR(&ce->properties_info, property_info) {
65-
if (zend_string_equals_literal(property_info->name, "name")) {
65+
if (zend_string_equals(property_info->name, ZSTR_KNOWN(ZEND_STR_NAME))) {
6666
continue;
6767
}
6868
if (
6969
ce->enum_backing_type != IS_UNDEF
70-
&& zend_string_equals_literal(property_info->name, "value")
70+
&& zend_string_equals(property_info->name, ZSTR_KNOWN(ZEND_STR_VALUE))
7171
) {
7272
continue;
7373
}

Zend/zend_interfaces.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry
344344
&class_type->function_table, "rewind", sizeof("rewind") - 1);
345345
funcs_ptr->zf_valid = zend_hash_str_find_ptr(
346346
&class_type->function_table, "valid", sizeof("valid") - 1);
347-
funcs_ptr->zf_key = zend_hash_str_find_ptr(
348-
&class_type->function_table, "key", sizeof("key") - 1);
347+
funcs_ptr->zf_key = zend_hash_find_ptr(
348+
&class_type->function_table, ZSTR_KNOWN(ZEND_STR_KEY));
349349
funcs_ptr->zf_current = zend_hash_str_find_ptr(
350350
&class_type->function_table, "current", sizeof("current") - 1);
351351
funcs_ptr->zf_next = zend_hash_str_find_ptr(

ext/curl/interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ static inline zend_result build_mime_structure_from_hash(php_curl *ch, zval *zpo
13771377
curl_seek_callback seekfunc = seek_cb;
13781378
#endif
13791379

1380-
prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "name", sizeof("name")-1, 0, &rv);
1380+
prop = zend_read_property_ex(curl_CURLFile_class, Z_OBJ_P(current), ZSTR_KNOWN(ZEND_STR_NAME), /* silent */ false, &rv);
13811381
ZVAL_DEREF(prop);
13821382
if (Z_TYPE_P(prop) != IS_STRING) {
13831383
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));

ext/dom/node.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,8 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
16221622
zval *tmp;
16231623
char *xquery;
16241624

1625-
tmp = zend_hash_str_find(ht, "query", sizeof("query")-1);
1625+
/* Find "query" key */
1626+
tmp = zend_hash_find(ht, ZSTR_KNOWN(ZEND_STR_QUERY));
16261627
if (!tmp) {
16271628
/* if mode == 0 then $xpath arg is 3, if mode == 1 then $xpath is 4 */
16281629
zend_argument_value_error(3 + mode, "must have a \"query\" key");

ext/ftp/ftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ ftp_mlsd_parse_line(HashTable *ht, const char *input) {
708708

709709
/* Extract pathname */
710710
ZVAL_STRINGL(&zstr, sp + 1, end - sp - 1);
711-
zend_hash_str_update(ht, "name", sizeof("name")-1, &zstr);
711+
zend_hash_update(ht, ZSTR_KNOWN(ZEND_STR_NAME), &zstr);
712712
end = sp;
713713

714714
while (input < end) {

ext/iconv/iconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ PHP_FUNCTION(iconv_mime_encode)
19781978
if (pref != NULL) {
19791979
zval *pzval;
19801980

1981-
if ((pzval = zend_hash_str_find_deref(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) {
1981+
if ((pzval = zend_hash_find_deref(Z_ARRVAL_P(pref), ZSTR_KNOWN(ZEND_STR_SCHEME))) != NULL) {
19821982
if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) {
19831983
switch (Z_STRVAL_P(pzval)[0]) {
19841984
case 'B': case 'b':

ext/ldap/ldap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
412412
struct berval control_value = { 0L, NULL };
413413
int control_value_alloc = 0;
414414

415-
if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "value", sizeof("value") - 1)) != NULL) {
415+
if ((val = zend_hash_find(Z_ARRVAL_P(array), ZSTR_KNOWN(ZEND_STR_VALUE))) != NULL) {
416416
if (Z_TYPE_P(val) != IS_ARRAY) {
417417
tmpstring = zval_get_string(val);
418418
if (EG(exception)) {
@@ -634,7 +634,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
634634
} else if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "offset", sizeof("offset") - 1)) != NULL) {
635635
vlvInfo.ldvlv_attrvalue = NULL;
636636
vlvInfo.ldvlv_offset = zval_get_long(tmp);
637-
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "count", sizeof("count") - 1)) != NULL) {
637+
/* Find "count" key */
638+
if ((tmp = zend_hash_find(Z_ARRVAL_P(val), ZSTR_KNOWN(ZEND_STR_COUNT))) != NULL) {
638639
vlvInfo.ldvlv_count = zval_get_long(tmp);
639640
} else {
640641
rc = -1;

ext/opcache/jit/zend_jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4822,7 +4822,7 @@ ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
48224822
JIT_G(trigger) = ZEND_JIT_ON_HOT_TRACE;
48234823
JIT_G(opt_flags) = ZEND_JIT_REG_ALLOC_GLOBAL | ZEND_JIT_CPU_AVX;
48244824
return SUCCESS;
4825-
} else if (zend_string_equals_literal_ci(jit, "function")) {
4825+
} else if (zend_string_equals_ci(jit, ZSTR_KNOWN(ZEND_STR_FUNCTION))) {
48264826
JIT_G(enabled) = 1;
48274827
JIT_G(on) = 1;
48284828
JIT_G(opt_level) = ZEND_JIT_LEVEL_OPT_SCRIPT;

ext/opcache/zend_persist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ void zend_update_parent_ce(zend_class_entry *ce)
11211121
if (zend_class_implements_interface(ce, zend_ce_iterator)) {
11221122
ce->iterator_funcs_ptr->zf_rewind = zend_hash_str_find_ptr(&ce->function_table, "rewind", sizeof("rewind") - 1);
11231123
ce->iterator_funcs_ptr->zf_valid = zend_hash_str_find_ptr(&ce->function_table, "valid", sizeof("valid") - 1);
1124-
ce->iterator_funcs_ptr->zf_key = zend_hash_str_find_ptr(&ce->function_table, "key", sizeof("key") - 1);
1124+
ce->iterator_funcs_ptr->zf_key = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_KEY));
11251125
ce->iterator_funcs_ptr->zf_current = zend_hash_str_find_ptr(&ce->function_table, "current", sizeof("current") - 1);
11261126
ce->iterator_funcs_ptr->zf_next = zend_hash_str_find_ptr(&ce->function_table, "next", sizeof("next") - 1);
11271127
}

ext/pdo_sqlite/sqlite_statement.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *ret
319319

320320
switch (sqlite3_column_type(S->stmt, colno)) {
321321
case SQLITE_NULL:
322-
add_assoc_string(return_value, "native_type", "null");
322+
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_NULL_LOWERCASE));
323323
add_assoc_long(return_value, "pdo_type", PDO_PARAM_NULL);
324324
break;
325325

326326
case SQLITE_FLOAT:
327-
add_assoc_string(return_value, "native_type", "double");
327+
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_DOUBLE));
328328
add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
329329
break;
330330

@@ -333,12 +333,12 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *ret
333333
/* TODO Check this is correct */
334334
ZEND_FALLTHROUGH;
335335
case SQLITE_TEXT:
336-
add_assoc_string(return_value, "native_type", "string");
336+
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_STRING));
337337
add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
338338
break;
339339

340340
case SQLITE_INTEGER:
341-
add_assoc_string(return_value, "native_type", "integer");
341+
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_INTEGER));
342342
add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT);
343343
break;
344344
}

ext/pgsql/pgsql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4296,7 +4296,7 @@ static php_pgsql_data_type php_pgsql_get_data_type(const zend_string *type_name)
42964296
/* This is stupid way to do. I'll fix it when I decide how to support
42974297
user defined types. (Yasuo) */
42984298
/* boolean */
4299-
if (zend_string_equals_literal(type_name, "bool")|| zend_string_equals_literal(type_name, "boolean"))
4299+
if (zend_string_equals(type_name, ZSTR_KNOWN(ZEND_STR_BOOL)) ||zend_string_equals(type_name, ZSTR_KNOWN(ZEND_STR_BOOLEAN)))
43004300
return PG_BOOL;
43014301
/* object id */
43024302
if (zend_string_equals_literal(type_name, "oid"))

ext/reflection/php_reflection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ ZEND_METHOD(Reflection, getModifierNames)
15601560
}
15611561

15621562
if (modifiers & ZEND_ACC_STATIC) {
1563-
add_next_index_stringl(return_value, "static", sizeof("static")-1);
1563+
add_next_index_str(return_value, ZSTR_KNOWN(ZEND_STR_STATIC));
15641564
}
15651565

15661566
if (modifiers & (ZEND_ACC_READONLY | ZEND_ACC_READONLY_CLASS)) {
@@ -7137,7 +7137,7 @@ ZEND_METHOD(ReflectionFiber, getCallable)
71377137
static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
71387138
{
71397139
if (zend_hash_exists(&object->ce->properties_info, name)
7140-
&& (zend_string_equals_literal(name, "name") || zend_string_equals_literal(name, "class")))
7140+
&& (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_NAME)) || zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_CLASS))))
71417141
{
71427142
zend_throw_exception_ex(reflection_exception_ptr, 0,
71437143
"Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));

ext/session/session.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ PHP_FUNCTION(session_module_name)
19271927
}
19281928

19291929
if (name) {
1930-
if (zend_string_equals_literal_ci(name, "user")) {
1930+
if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_USER))) {
19311931
zend_argument_value_error(1, "cannot be \"user\"");
19321932
RETURN_THROWS();
19331933
}
@@ -1967,7 +1967,7 @@ static inline void set_user_save_handler_ini(void) {
19671967
zend_string *ini_name, *ini_val;
19681968

19691969
ini_name = ZSTR_INIT_LITERAL("session.save_handler", 0);
1970-
ini_val = ZSTR_INIT_LITERAL("user", 0);
1970+
ini_val = ZSTR_KNOWN(ZEND_STR_USER);
19711971
PS(set_handler) = 1;
19721972
zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
19731973
PS(set_handler) = 0;

ext/simplexml/simplexml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,8 @@ static zend_function* php_sxe_find_fptr_count(zend_class_entry *ce)
21912191
}
21922192

21932193
if (inherited) {
2194-
fptr_count = zend_hash_str_find_ptr(&ce->function_table, "count", sizeof("count") - 1);
2194+
/* Find count() method */
2195+
fptr_count = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
21952196
if (fptr_count->common.scope == parent) {
21962197
fptr_count = NULL;
21972198
}

ext/soap/soap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ PHP_METHOD(SoapFault, __toString)
584584
this_ptr = ZEND_THIS;
585585
faultcode = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultcode", sizeof("faultcode")-1, 1, &rv1);
586586
faultstring = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultstring", sizeof("faultstring")-1, 1, &rv2);
587-
file = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "file", sizeof("file")-1, 1, &rv3);
588-
line = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "line", sizeof("line")-1, 1, &rv4);
587+
file = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr), ZSTR_KNOWN(ZEND_STR_FILE), /* silent */ true, &rv3);
588+
line = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr), ZSTR_KNOWN(ZEND_STR_LINE), /* silent */ true, &rv4);
589589

590590
zend_call_method_with_0_params(
591591
Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), NULL, "gettraceasstring", &trace);
@@ -1107,7 +1107,7 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi
11071107
} else if (instanceof_function(Z_OBJCE(exception_object), zend_ce_error)) {
11081108
if (service->send_errors) {
11091109
zval rv;
1110-
zend_string *msg = zval_get_string(zend_read_property(zend_ce_error, Z_OBJ(exception_object), "message", sizeof("message")-1, 0, &rv));
1110+
zend_string *msg = zval_get_string(zend_read_property_ex(zend_ce_error, Z_OBJ(exception_object), ZSTR_KNOWN(ZEND_STR_MESSAGE), /* silent */ false, &rv));
11111111
add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL);
11121112
zend_string_release_ex(msg, 0);
11131113
} else {
@@ -1943,7 +1943,7 @@ PHP_METHOD(SoapClient, __construct)
19431943
php_stream_context_set_option(context, "ssl", "passphrase", tmp);
19441944
}
19451945
}
1946-
if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL &&
1946+
if ((tmp = zend_hash_find(ht, ZSTR_KNOWN(ZEND_STR_TRACE))) != NULL &&
19471947
(Z_TYPE_P(tmp) == IS_TRUE ||
19481948
(Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) {
19491949
ZVAL_TRUE(Z_CLIENT_TRACE_P(this_ptr));
@@ -2747,7 +2747,7 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha
27472747
}
27482748

27492749
ZVAL_STRING(Z_FAULT_STRING_P(obj), fault_string ? fault_string : "");
2750-
zend_update_property_string(zend_ce_exception, Z_OBJ_P(obj), "message", sizeof("message")-1, (fault_string ? fault_string : ""));
2750+
zend_update_property_ex(zend_ce_exception, Z_OBJ_P(obj), ZSTR_KNOWN(ZEND_STR_MESSAGE), Z_FAULT_STRING_P(obj));
27512751

27522752
if (fault_code != NULL) {
27532753
int soap_version = SOAP_GLOBAL(soap_version);

ext/sodium/libsodium.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ ZEND_GET_MODULE(sodium)
125125
/* Remove argument information from backtrace to prevent information leaks */
126126
static void sodium_remove_param_values_from_backtrace(zend_object *obj) {
127127
zval rv;
128-
zval *trace = zend_read_property(zend_get_exception_base(obj), obj, "trace", sizeof("trace")-1, 0, &rv);
128+
zval *trace = zend_read_property_ex(zend_get_exception_base(obj), obj, ZSTR_KNOWN(ZEND_STR_TRACE), /* silent */ false, &rv);
129129
if (trace && Z_TYPE_P(trace) == IS_ARRAY) {
130130
zval *frame;
131131
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(trace), frame) {
132132
if (Z_TYPE_P(frame) == IS_ARRAY) {
133-
zval *args = zend_hash_str_find(Z_ARRVAL_P(frame), "args", sizeof("args")-1);
133+
zval *args = zend_hash_find(Z_ARRVAL_P(frame), ZSTR_KNOWN(ZEND_STR_ARGS));
134134
if (args) {
135135
zval_ptr_dtor(args);
136136
ZVAL_EMPTY_ARRAY(args);

0 commit comments

Comments
 (0)