-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Improve error messages mentioning parameters instead of arguments #5999
Conversation
9425533
to
c0422ce
Compare
0257580
to
86fecd9
Compare
f114414
to
25bbdcc
Compare
32038d6
to
84557e1
Compare
84557e1
to
663d012
Compare
return zend_create_member_string(func->common.scope->name, func->common.function_name); | ||
} | ||
|
||
return func->common.function_name ? zend_string_copy(func->common.function_name) : zend_string_init("main", sizeof("main") - 1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or alternatively, should we could add an assert that function_name is not null?
c544ffb
to
1cd5faf
Compare
Zend/zend_execute_API.c
Outdated
/* }}} */ | ||
|
||
/* return class name and "::" or "". */ | ||
ZEND_API const char *get_class_name(const zend_function *func, const char **space) /* {{{ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem needed for anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that they will come handy in the future, but probably we shouldn't prematurely optimize for the future in this case :) so I've just removed the unneeded functions.
Zend/zend_execute_API.c
Outdated
} | ||
/* }}} */ | ||
|
||
ZEND_API const char *get_function_name(const zend_function *func) /* {{{ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem needed for anything?
Zend/zend_execute_API.c
Outdated
{ | ||
if (!zend_is_executing()) { | ||
return zend_string_init("", 0, 0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can ZEND_ASSERT this, I think.
ext/opcache/jit/zend_jit_helpers.c
Outdated
); | ||
|
||
zend_string_release(func_name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have this in a function in zend_execute.c that can be used both by zend_vm_def and jit?
ext/opcache/jit/zend_jit_x86.dasc
Outdated
| LOAD_ADDR CARG2, "Cannot pass parameter %d by reference" | ||
| mov CARG3d, dword OP:r0->op2.num | ||
| EXT_CALL zend_throw_error, r0 | ||
| mov CARG1d, dword OP:r0->op2.num |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| mov CARG1d, dword OP:r0->op2.num | |
| mov FCARG1d, dword OP:r0->op2.num |
and drop the if/else.
4ae6447
to
910a199
Compare
910a199
to
23f1a00
Compare
@@ -583,6 +583,19 @@ static zend_never_inline ZEND_COLD bool zend_wrong_assign_to_variable_reference( | |||
return 1; | |||
} | |||
|
|||
ZEND_API void zend_cannot_pass_by_reference(uint32_t arg_num) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZEND_API void zend_cannot_pass_by_reference(uint32_t arg_num) | |
ZEND_API ZEND_COLD void zend_cannot_pass_by_reference(uint32_t arg_num) |
Cannot pass parameter 1 by reference
->test(): Argument #1 ($param) cannot be passed by reference
str_pad() expects at least 2 parameters, 1 given
->str_pad() expects at least 2 arguments, 1 given
Warning: count(): Parameter must be an array or an object that implements Countable
->Warning: count(): Argument #1 ($var) must be of type Countable|array, Generator given