[php-src] PR #15922: Reflection: show the name of object constants used as default properties
| From: | DanielEScherzer | Date: | Mon, 16 Sep 2024 17:22:48 +0000 |
| Subject: | [php-src] PR #15922: Reflection: show the name of object constants used as default properties | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28622@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15922
Author: DanielEScherzer
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 gh-15902