Skip to content

More usage of known zend_str instead of C string #11381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -3529,7 +3529,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc
*strict_class = 1;
ret = 1;
}
} else if (zend_string_equals_literal(lcname, "static")) {
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_STATIC))) {
zend_class_entry *called_scope = zend_get_called_scope(frame);

if (!called_scope) {
Expand Down Expand Up @@ -4560,7 +4560,7 @@ ZEND_API zend_class_constant *zend_declare_typed_class_constant(zend_class_entry
}
}

if (zend_string_equals_literal_ci(name, "class")) {
if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_CLASS))) {
zend_error_noreturn(ce->type == ZEND_INTERNAL_CLASS ? E_CORE_ERROR : E_COMPILE_ERROR,
"A class constant must not be called 'class'; it is reserved for class name fetching");
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_constant(zend_string *name, ze

ZEND_API zend_ast * ZEND_FASTCALL zend_ast_create_class_const_or_name(zend_ast *class_name, zend_ast *name) {
zend_string *name_str = zend_ast_get_str(name);
if (zend_string_equals_literal_ci(name_str, "class")) {
if (zend_string_equals_ci(name_str, ZSTR_KNOWN(ZEND_STR_CLASS))) {
zend_string_release(name_str);
return zend_ast_create(ZEND_AST_CLASS_NAME, class_name);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ZEND_METHOD(SensitiveParameterValue, __construct)
Z_PARAM_ZVAL(value)
ZEND_PARSE_PARAMETERS_END();

zend_update_property(zend_ce_sensitive_parameter_value, Z_OBJ_P(ZEND_THIS), "value", strlen("value"), value);
zend_update_property_ex(zend_ce_sensitive_parameter_value, Z_OBJ_P(ZEND_THIS), ZSTR_KNOWN(ZEND_STR_VALUE), value);
}

ZEND_METHOD(SensitiveParameterValue, getValue)
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ ZEND_FUNCTION(get_defined_functions)
} ZEND_HASH_FOREACH_END();

zend_hash_str_add_new(Z_ARRVAL_P(return_value), "internal", sizeof("internal")-1, &internal);
zend_hash_str_add_new(Z_ARRVAL_P(return_value), "user", sizeof("user")-1, &user);
zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_USER), &user);
}
/* }}} */

Expand Down
20 changes: 10 additions & 10 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ ZEND_API zend_string *zend_type_to_string(zend_type type) {
}

static bool is_generator_compatible_class_type(zend_string *name) {
return zend_string_equals_literal_ci(name, "Traversable")
return zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_TRAVERSABLE))
|| zend_string_equals_literal_ci(name, "Iterator")
|| zend_string_equals_literal_ci(name, "Generator");
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@ uint32_t zend_get_class_fetch_type(const zend_string *name) /* {{{ */
return ZEND_FETCH_CLASS_SELF;
} else if (zend_string_equals_literal_ci(name, "parent")) {
return ZEND_FETCH_CLASS_PARENT;
} else if (zend_string_equals_literal_ci(name, "static")) {
} else if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
return ZEND_FETCH_CLASS_STATIC;
} else {
return ZEND_FETCH_CLASS_DEFAULT;
Expand Down Expand Up @@ -2821,7 +2821,7 @@ static bool is_this_fetch(zend_ast *ast) /* {{{ */
{
if (ast->kind == ZEND_AST_VAR && ast->child[0]->kind == ZEND_AST_ZVAL) {
zval *name = zend_ast_get_zval(ast->child[0]);
return Z_TYPE_P(name) == IS_STRING && zend_string_equals_literal(Z_STR_P(name), "this");
return Z_TYPE_P(name) == IS_STRING && zend_string_equals(Z_STR_P(name), ZSTR_KNOWN(ZEND_STR_THIS));
}

return 0;
Expand Down Expand Up @@ -4522,7 +4522,7 @@ static zend_result zend_try_compile_special_func(znode *result, zend_string *lcn
return zend_compile_func_cuf(result, args, lcname);
} else if (zend_string_equals_literal(lcname, "in_array")) {
return zend_compile_func_in_array(result, args);
} else if (zend_string_equals_literal(lcname, "count")
} else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_COUNT))
|| zend_string_equals_literal(lcname, "sizeof")) {
return zend_compile_func_count(result, args, lcname);
} else if (zend_string_equals_literal(lcname, "get_class")) {
Expand Down Expand Up @@ -4872,7 +4872,7 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u

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

if (zend_string_equals_literal(var_name, "this")) {
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as static variable");
}

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

if (zend_string_equals_literal(var_name, "this")) {
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as static variable");
}

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

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

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

Expand Down Expand Up @@ -7152,7 +7152,7 @@ static void zend_compile_closure_binding(znode *closure, zend_op_array *op_array
zend_op *opline;
zval *value;

if (zend_string_equals_literal(var_name, "this")) {
if (zend_string_equals(var_name, ZSTR_KNOWN(ZEND_STR_THIS))) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as lexical variable");
}

Expand Down Expand Up @@ -7196,7 +7196,7 @@ static void find_implicit_binds_recursively(closure_info *info, zend_ast *ast) {
return;
}

if (zend_string_equals_literal(name, "this")) {
if (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS))) {
/* $this does not need to be explicitly imported. */
return;
}
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ ZEND_API zval *zend_get_class_constant_ex(zend_string *class_name, zend_string *
} else {
ce = scope->parent;
}
} else if (zend_string_equals_literal_ci(class_name, "static")) {
} else if (zend_string_equals_ci(class_name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
ce = zend_get_called_scope(EG(current_execute_data));
if (UNEXPECTED(!ce)) {
zend_throw_error(NULL, "Cannot access \"static\" when no class scope is active");
Expand Down Expand Up @@ -419,7 +419,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
} else {
ce = scope->parent;
}
} else if (zend_string_equals_literal_ci(class_name, "static")) {
} else if (zend_string_equals_ci(class_name, ZSTR_KNOWN(ZEND_STR_STATIC))) {
ce = zend_get_called_scope(EG(current_execute_data));
if (UNEXPECTED(!ce)) {
zend_throw_error(NULL, "Cannot access \"static\" when no class scope is active");
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ static void zend_verify_enum_properties(zend_class_entry *ce)
zend_property_info *property_info;

ZEND_HASH_MAP_FOREACH_PTR(&ce->properties_info, property_info) {
if (zend_string_equals_literal(property_info->name, "name")) {
if (zend_string_equals(property_info->name, ZSTR_KNOWN(ZEND_STR_NAME))) {
continue;
}
if (
ce->enum_backing_type != IS_UNDEF
&& zend_string_equals_literal(property_info->name, "value")
&& zend_string_equals(property_info->name, ZSTR_KNOWN(ZEND_STR_VALUE))
) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_interfaces.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry
&class_type->function_table, "rewind", sizeof("rewind") - 1);
funcs_ptr->zf_valid = zend_hash_str_find_ptr(
&class_type->function_table, "valid", sizeof("valid") - 1);
funcs_ptr->zf_key = zend_hash_str_find_ptr(
&class_type->function_table, "key", sizeof("key") - 1);
funcs_ptr->zf_key = zend_hash_find_ptr(
&class_type->function_table, ZSTR_KNOWN(ZEND_STR_KEY));
funcs_ptr->zf_current = zend_hash_str_find_ptr(
&class_type->function_table, "current", sizeof("current") - 1);
funcs_ptr->zf_next = zend_hash_str_find_ptr(
Expand Down
2 changes: 1 addition & 1 deletion ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ static inline zend_result build_mime_structure_from_hash(php_curl *ch, zval *zpo
curl_seek_callback seekfunc = seek_cb;
#endif

prop = zend_read_property(curl_CURLFile_class, Z_OBJ_P(current), "name", sizeof("name")-1, 0, &rv);
prop = zend_read_property_ex(curl_CURLFile_class, Z_OBJ_P(current), ZSTR_KNOWN(ZEND_STR_NAME), /* silent */ false, &rv);
ZVAL_DEREF(prop);
if (Z_TYPE_P(prop) != IS_STRING) {
php_error_docref(NULL, E_WARNING, "Invalid filename for key %s", ZSTR_VAL(string_key));
Expand Down
3 changes: 2 additions & 1 deletion ext/dom/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,8 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
zval *tmp;
char *xquery;

tmp = zend_hash_str_find(ht, "query", sizeof("query")-1);
/* Find "query" key */
tmp = zend_hash_find(ht, ZSTR_KNOWN(ZEND_STR_QUERY));
if (!tmp) {
/* if mode == 0 then $xpath arg is 3, if mode == 1 then $xpath is 4 */
zend_argument_value_error(3 + mode, "must have a \"query\" key");
Expand Down
2 changes: 1 addition & 1 deletion ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ ftp_mlsd_parse_line(HashTable *ht, const char *input) {

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

while (input < end) {
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ PHP_FUNCTION(iconv_mime_encode)
if (pref != NULL) {
zval *pzval;

if ((pzval = zend_hash_str_find_deref(Z_ARRVAL_P(pref), "scheme", sizeof("scheme") - 1)) != NULL) {
if ((pzval = zend_hash_find_deref(Z_ARRVAL_P(pref), ZSTR_KNOWN(ZEND_STR_SCHEME))) != NULL) {
if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) {
switch (Z_STRVAL_P(pzval)[0]) {
case 'B': case 'b':
Expand Down
5 changes: 3 additions & 2 deletions ext/ldap/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
struct berval control_value = { 0L, NULL };
int control_value_alloc = 0;

if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "value", sizeof("value") - 1)) != NULL) {
if ((val = zend_hash_find(Z_ARRVAL_P(array), ZSTR_KNOWN(ZEND_STR_VALUE))) != NULL) {
if (Z_TYPE_P(val) != IS_ARRAY) {
tmpstring = zval_get_string(val);
if (EG(exception)) {
Expand Down Expand Up @@ -634,7 +634,8 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra
} else if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "offset", sizeof("offset") - 1)) != NULL) {
vlvInfo.ldvlv_attrvalue = NULL;
vlvInfo.ldvlv_offset = zval_get_long(tmp);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "count", sizeof("count") - 1)) != NULL) {
/* Find "count" key */
if ((tmp = zend_hash_find(Z_ARRVAL_P(val), ZSTR_KNOWN(ZEND_STR_COUNT))) != NULL) {
vlvInfo.ldvlv_count = zval_get_long(tmp);
} else {
rc = -1;
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4822,7 +4822,7 @@ ZEND_EXT_API int zend_jit_config(zend_string *jit, int stage)
JIT_G(trigger) = ZEND_JIT_ON_HOT_TRACE;
JIT_G(opt_flags) = ZEND_JIT_REG_ALLOC_GLOBAL | ZEND_JIT_CPU_AVX;
return SUCCESS;
} else if (zend_string_equals_literal_ci(jit, "function")) {
} else if (zend_string_equals_ci(jit, ZSTR_KNOWN(ZEND_STR_FUNCTION))) {
JIT_G(enabled) = 1;
JIT_G(on) = 1;
JIT_G(opt_level) = ZEND_JIT_LEVEL_OPT_SCRIPT;
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ void zend_update_parent_ce(zend_class_entry *ce)
if (zend_class_implements_interface(ce, zend_ce_iterator)) {
ce->iterator_funcs_ptr->zf_rewind = zend_hash_str_find_ptr(&ce->function_table, "rewind", sizeof("rewind") - 1);
ce->iterator_funcs_ptr->zf_valid = zend_hash_str_find_ptr(&ce->function_table, "valid", sizeof("valid") - 1);
ce->iterator_funcs_ptr->zf_key = zend_hash_str_find_ptr(&ce->function_table, "key", sizeof("key") - 1);
ce->iterator_funcs_ptr->zf_key = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_KEY));
ce->iterator_funcs_ptr->zf_current = zend_hash_str_find_ptr(&ce->function_table, "current", sizeof("current") - 1);
ce->iterator_funcs_ptr->zf_next = zend_hash_str_find_ptr(&ce->function_table, "next", sizeof("next") - 1);
}
Expand Down
8 changes: 4 additions & 4 deletions ext/pdo_sqlite/sqlite_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *ret

switch (sqlite3_column_type(S->stmt, colno)) {
case SQLITE_NULL:
add_assoc_string(return_value, "native_type", "null");
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_NULL_LOWERCASE));
add_assoc_long(return_value, "pdo_type", PDO_PARAM_NULL);
break;

case SQLITE_FLOAT:
add_assoc_string(return_value, "native_type", "double");
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_DOUBLE));
add_assoc_long(return_value, "pdo_type", PDO_PARAM_STR);
break;

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

case SQLITE_INTEGER:
add_assoc_string(return_value, "native_type", "integer");
add_assoc_str(return_value, "native_type", ZSTR_KNOWN(ZEND_STR_INTEGER));
add_assoc_long(return_value, "pdo_type", PDO_PARAM_INT);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -4296,7 +4296,7 @@ static php_pgsql_data_type php_pgsql_get_data_type(const zend_string *type_name)
/* This is stupid way to do. I'll fix it when I decide how to support
user defined types. (Yasuo) */
/* boolean */
if (zend_string_equals_literal(type_name, "bool")|| zend_string_equals_literal(type_name, "boolean"))
if (zend_string_equals(type_name, ZSTR_KNOWN(ZEND_STR_BOOL)) ||zend_string_equals(type_name, ZSTR_KNOWN(ZEND_STR_BOOLEAN)))
return PG_BOOL;
/* object id */
if (zend_string_equals_literal(type_name, "oid"))
Expand Down
4 changes: 2 additions & 2 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ ZEND_METHOD(Reflection, getModifierNames)
}

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

if (modifiers & (ZEND_ACC_READONLY | ZEND_ACC_READONLY_CLASS)) {
Expand Down Expand Up @@ -7137,7 +7137,7 @@ ZEND_METHOD(ReflectionFiber, getCallable)
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)
&& (zend_string_equals_literal(name, "name") || zend_string_equals_literal(name, "class")))
&& (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_NAME)) || zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_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
4 changes: 2 additions & 2 deletions ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,7 @@ PHP_FUNCTION(session_module_name)
}

if (name) {
if (zend_string_equals_literal_ci(name, "user")) {
if (zend_string_equals_ci(name, ZSTR_KNOWN(ZEND_STR_USER))) {
zend_argument_value_error(1, "cannot be \"user\"");
RETURN_THROWS();
}
Expand Down Expand Up @@ -1967,7 +1967,7 @@ static inline void set_user_save_handler_ini(void) {
zend_string *ini_name, *ini_val;

ini_name = ZSTR_INIT_LITERAL("session.save_handler", 0);
ini_val = ZSTR_INIT_LITERAL("user", 0);
ini_val = ZSTR_KNOWN(ZEND_STR_USER);
PS(set_handler) = 1;
zend_alter_ini_entry(ini_name, ini_val, PHP_INI_USER, PHP_INI_STAGE_RUNTIME);
PS(set_handler) = 0;
Expand Down
3 changes: 2 additions & 1 deletion ext/simplexml/simplexml.c
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,8 @@ static zend_function* php_sxe_find_fptr_count(zend_class_entry *ce)
}

if (inherited) {
fptr_count = zend_hash_str_find_ptr(&ce->function_table, "count", sizeof("count") - 1);
/* Find count() method */
fptr_count = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
if (fptr_count->common.scope == parent) {
fptr_count = NULL;
}
Expand Down
10 changes: 5 additions & 5 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ PHP_METHOD(SoapFault, __toString)
this_ptr = ZEND_THIS;
faultcode = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultcode", sizeof("faultcode")-1, 1, &rv1);
faultstring = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "faultstring", sizeof("faultstring")-1, 1, &rv2);
file = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "file", sizeof("file")-1, 1, &rv3);
line = zend_read_property(soap_fault_class_entry, Z_OBJ_P(this_ptr), "line", sizeof("line")-1, 1, &rv4);
file = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr), ZSTR_KNOWN(ZEND_STR_FILE), /* silent */ true, &rv3);
line = zend_read_property_ex(soap_fault_class_entry, Z_OBJ_P(this_ptr), ZSTR_KNOWN(ZEND_STR_LINE), /* silent */ true, &rv4);

zend_call_method_with_0_params(
Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), NULL, "gettraceasstring", &trace);
Expand Down Expand Up @@ -1107,7 +1107,7 @@ static void _soap_server_exception(soapServicePtr service, sdlFunctionPtr functi
} else if (instanceof_function(Z_OBJCE(exception_object), zend_ce_error)) {
if (service->send_errors) {
zval rv;
zend_string *msg = zval_get_string(zend_read_property(zend_ce_error, Z_OBJ(exception_object), "message", sizeof("message")-1, 0, &rv));
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));
add_soap_fault_ex(&exception_object, this_ptr, "Server", ZSTR_VAL(msg), NULL, NULL);
zend_string_release_ex(msg, 0);
} else {
Expand Down Expand Up @@ -1943,7 +1943,7 @@ PHP_METHOD(SoapClient, __construct)
php_stream_context_set_option(context, "ssl", "passphrase", tmp);
}
}
if ((tmp = zend_hash_str_find(ht, "trace", sizeof("trace")-1)) != NULL &&
if ((tmp = zend_hash_find(ht, ZSTR_KNOWN(ZEND_STR_TRACE))) != NULL &&
(Z_TYPE_P(tmp) == IS_TRUE ||
(Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 1))) {
ZVAL_TRUE(Z_CLIENT_TRACE_P(this_ptr));
Expand Down Expand Up @@ -2747,7 +2747,7 @@ static void set_soap_fault(zval *obj, char *fault_code_ns, char *fault_code, cha
}

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

if (fault_code != NULL) {
int soap_version = SOAP_GLOBAL(soap_version);
Expand Down
4 changes: 2 additions & 2 deletions ext/sodium/libsodium.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ ZEND_GET_MODULE(sodium)
/* Remove argument information from backtrace to prevent information leaks */
static void sodium_remove_param_values_from_backtrace(zend_object *obj) {
zval rv;
zval *trace = zend_read_property(zend_get_exception_base(obj), obj, "trace", sizeof("trace")-1, 0, &rv);
zval *trace = zend_read_property_ex(zend_get_exception_base(obj), obj, ZSTR_KNOWN(ZEND_STR_TRACE), /* silent */ false, &rv);
if (trace && Z_TYPE_P(trace) == IS_ARRAY) {
zval *frame;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(trace), frame) {
if (Z_TYPE_P(frame) == IS_ARRAY) {
zval *args = zend_hash_str_find(Z_ARRVAL_P(frame), "args", sizeof("args")-1);
zval *args = zend_hash_find(Z_ARRVAL_P(frame), ZSTR_KNOWN(ZEND_STR_ARGS));
if (args) {
zval_ptr_dtor(args);
ZVAL_EMPTY_ARRAY(args);
Expand Down
Loading