<?php
set_error_handler(function() {
throw new Exception();
});
class A
{
public function method($test = UNKNOWN_CONSTANT)
{
}
}
$class = new ReflectionClass('A');
echo $class;
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Class [ <user> class A ] {
@@ /in/ekEkd 7-12
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [1] {
Method [ <user> public method method ] {
@@ /in/ekEkd 9 - 11
- Parameters [1] {
Parameter #0 [ <optional> $test = UNKNOWN_CONSTANT ]
}
}
}
}
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught Error: Undefined constant "UNKNOWN_CONSTANT" in /in/ekEkd:16
Stack trace:
#0 /in/ekEkd(16): ReflectionClass->__toString()
#1 {main}
thrown in /in/ekEkd on line 16
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Uncaught Exception in /in/ekEkd:4
Stack trace:
#0 [internal function]: {closure}(2, 'Use of undefine...', '/in/ekEkd', 16, Array)
#1 /in/ekEkd(16): ReflectionClass->__toString()
#2 {main}
thrown in /in/ekEkd on line 4
Process exited with code 255.