-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use ZEND_TOSTRING_FUNC_NAME #5736
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
Conversation
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.
👎 on this one. ZEND_TOSTRING_FUNC_NAME
is tostring
, which is not aligned with toString
.
@carusogabriel Nice catch! |
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.
Oh, wait, you're using method_lcname
, I didn't see that, sorry. 👍 on this case
I wasn't using it before, I just pushed a new commit addressing your review. Thanks! |
Zend/zend_compile.c
Outdated
@@ -6465,7 +6465,7 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, zend_bool toplevel) /* | |||
} | |||
|
|||
zend_compile_params(params_ast, return_type_ast, | |||
is_method && zend_string_equals_literal_ci(decl->name, "__toString") ? IS_STRING : 0); | |||
is_method && zend_string_equals_literal_ci(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 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.
is_method && zend_string_equals_literal_ci(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 0); | |
is_method && zend_string_equals_literal(method_lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 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.
Thanks, updated the PR. I'm not sure though what's the difference, I suppose the _ci
version is case insensitive?
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.
Yes, that's correct.
Replaces
"__toString"
with a specialized constantZEND_TOSTRING_FUNC_NAME
.