-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs #10170
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.
Changes to the stub generator LGTM as far as I can tell. Ideally also add an actual test to zend_test
to verify the attribute is applied properly.
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.
LGTM now, thanks!
I've just realized that we could add support for generating attributes for class constants and properties as well... So I also implemented this feature. P.S. Another thing I noticed is that gen_stub.php cannot generate multiple attributes for the same symbol, otherwise there is a variable name collision in the generated code. I'll fix this in a followup PR. |
} else { | ||
$template = "\tzend_declare_property_ex(class_entry, $nameCode, &$zvalName, %s, NULL);\n"; |
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 was necessary to change to zend_declare_typed_property
, because unfortunately zend_declare_property_ex
doesn't return the zend_property_info
.
if (!$php82MinimumCompatibility) { | ||
$code .= "#if (PHP_VERSION_ID >= " . PHP_82_VERSION_ID . ")\n"; | ||
$code .= "#if (PHP_VERSION_ID >= " . PHP_82_VERSION_ID . ")"; |
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.
this endline character was superfluous
Sorry, it was a false alarm. :) |
Update: No, it's not when an attribute is repeatable. |
It seems to me that the new attributes cause some issues in the JIT engine :/ |
02cb104
to
e4b76d7
Compare
Sorry, I rebased to the wrong branch (master instead of PHP-8.2) after a conflict resolution. :/ So I had to squash my previous commits into one and cherry-pick it to PHP-8.2 |
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 don't have any further remarks.
d11c94a
to
bac8040
Compare
b2a274f
to
ff0f695
Compare
…t, and property attributes in stubs
ff0f695
to
2abe28b
Compare
Unfortunately, as mentioned in the commit comments this caused multiple issues.
I was able to fix 1 and 2 in this PR. However, I was unable to reproduce the ASAN failure locally and as such could not fix it. Since Máté is absent atm I reverted the changes for now. Please re-apply the changes to |
Turns out the ASAN error was caused by 9f4bd30 which I also reverted for now. I will try to find the cause tomorrow. |
@kocsismate Reminder: This commit was never re-applied. #11582 contained fixed that should work now, I'd prefer only applying this to |
@iluuu1994 Thanks for the reminder! I was aware, but was busy with other stuff, and I didn't really know whether there was really an ASAN failure (or just due to 9f4bd30). Could you please re-add your fix? And then I'll reapply my changes in master. |
@kocsismate No worries, I might have a clue why you were buy 😉👶 The ASAN failure was just caused by 9f4bd30 but tbh I completely forgot what I did to fix it. It's best if you apply my fixed in #11582 on top of your changes here in a new PR, so that they can be tested together. |
No description provided.