mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
When dumping default values in ReflectionXXX::__toString(), for expression initializers print the AST export instead of trying to evaluate the expression. With the introduction of "new in initializers" the result of the evaluation will commonly not be printable at all, and "__toString" will throw an exception, which is not particularly useful. Using the AST export also provides more information on how the parameter was originally declared, e.g. it preserves the fact that a certain constant was used. Closes GH-7540.
43 lines
575 B
PHP
43 lines
575 B
PHP
--TEST--
|
|
Bug #74673 (Segfault when cast Reflection object to string with undefined constant)
|
|
--FILE--
|
|
<?php
|
|
|
|
class A
|
|
{
|
|
public function method($test = PHP_SELF + 1)
|
|
{
|
|
}
|
|
}
|
|
|
|
$class = new ReflectionClass('A');
|
|
|
|
echo $class;
|
|
?>
|
|
--EXPECTF--
|
|
Class [ <user> class A ] {
|
|
@@ %s
|
|
|
|
- Constants [0] {
|
|
}
|
|
|
|
- Static properties [0] {
|
|
}
|
|
|
|
- Static methods [0] {
|
|
}
|
|
|
|
- Properties [0] {
|
|
}
|
|
|
|
- Methods [1] {
|
|
Method [ <user> public method method ] {
|
|
@@ %s
|
|
|
|
- Parameters [1] {
|
|
Parameter #0 [ <optional> $test = PHP_SELF + 1 ]
|
|
}
|
|
}
|
|
}
|
|
}
|