Skip to content

Minor cleanups in Zend execution APIs #10699

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 3 commits into from
Feb 26, 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
6 changes: 3 additions & 3 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2749,7 +2749,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
if (ptr->flags) {
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
if (ptr->flags != ZEND_ACC_DEPRECATED && scope) {
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
zend_error(error_type, "Invalid access level for %s::%s() - access must be exactly one of public, protected or private", ZSTR_VAL(scope->name), ptr->fname);
}
internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
} else {
Expand Down Expand Up @@ -3797,9 +3797,9 @@ static zend_always_inline bool zend_is_callable_check_func(zval *callable, zend_
}
} else if (error) {
if (fcc->calling_scope) {
if (error) zend_spprintf(error, 0, "class %s does not have a method \"%s\"", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(mname));
zend_spprintf(error, 0, "class %s does not have a method \"%s\"", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(mname));
} else {
if (error) zend_spprintf(error, 0, "function %s() does not exist", ZSTR_VAL(mname));
zend_spprintf(error, 0, "function %s() does not exist", ZSTR_VAL(mname));
}
}
zend_string_release_ex(lmname, 0);
Expand Down
6 changes: 2 additions & 4 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -3365,11 +3365,9 @@ static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval
}
*retval = zend_std_get_static_property_with_info(ce, name, fetch_type, &property_info);

if (UNEXPECTED(op1_type != IS_CONST)) {
zend_tmp_string_release(tmp_name);
zend_tmp_string_release(tmp_name);

FREE_OP(op1_type, opline->op1.var);
}
FREE_OP(op1_type, opline->op1.var);
}

if (UNEXPECTED(*retval == NULL)) {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
if (key) {
lc_name = key;
} else {
if (name == NULL || !ZSTR_LEN(name)) {
if (!ZSTR_LEN(name)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to add a ZEND_ASSERT(name); at the top of the function.

return NULL;
}

Expand Down