-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow CTE on basic type/math functions #10842
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.
Thanks!
This reverts commit 069fa1a.
I went through the PR again. I think the functions on which you added CTE are safe.
|
As long as a function is CTEable, I would say there should be no arbitrary limit of arguments.
Yes, someone wants it, someone not. I would say 6 total changes across the whole php-src are worth vs. the total "preferred" order. |
Let's please merge this PR if there is no feedback left so I can finish finish another PR on top of it. Thank you. |
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.
It seems that first compile-time-eval followed by refcount is the most common form. So therefore I think making this consistent in this PR is fine.
The functions marked as CTE were determined to be correctly marked.
function strval(mixed $value): string {} | ||
|
||
/** | ||
* @compile-time-eval | ||
*/ | ||
function is_null(mixed $value): bool {} | ||
|
||
function is_resource(mixed $value): bool {} |
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.
Can is_resource
cause issues when called at compile time? Otherwise, it could still eliminate calls when elements are not resources.
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.
Correct me if I am wrong, but can resource be even observed on CT?
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.
No, but it could eliminate calls like is_resource(42)
.
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 added is_resource
, tests pass, the 1 ASAN failure is unrelated.
as requested in #10771 (comment)
once this PR is merged, we can discuss the remaining functions