-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Core dumped in ext/reflection/php_reflection.c #15902
Comments
Minimal reproduction:
|
So it seems that depending on the reproduction case, the printed value for the default of On the other hand, if the line With an example based on the original report, where the class declaration is followed by
the property is And if the property never gets evaluated, i.e. the The |
Also affects ReflectionProperty:
has the default as |
I believed I tracked down the cause to Lines 1468 to 1485 in c7397f5
the value that was of type |
When a property default is based on a global constant, identify and use the name of that constant. Previously, `format_default_value()` assumed that non-scalar and non-array defaults were always going to be `IS_CONSTANT_AST` pointers, and when the AST expression had been evaluated and produced an object, depending on when the `ReflectionClass` or `ReflectionProperty` instance had been created, the default was shown as one of `callable`, `__CLASS__`, or `...`. Instead, if the default value is an object (`IS_OBJECT`), find the name of the `zend_constant` in the global `EG(zend_constants)` that points to the same value, and show that name. If no constant is found, instead of the confusing output of treating the object as an `IS_CONSTANT_AST` value, show `"<Unknown object value>"`. Add test cases for each of the `callable`, `__CLASS__`, and `...` cases to confirm that they all now properly show the name of the constant. Closes phpgh-15902
Given that this is going to technically be a behavior change for something that wasn't crashing in non-debug builds, PR sent to target |
Description
The following code:
Resulted in this output:
PHP Version
PHP 8.4.0-dev
Operating System
ubuntu 22.04
The text was updated successfully, but these errors were encountered: