bug51905.phpt 578 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #51905 (ReflectionParameter fails if default value is an array with an access to self::)
  3. --FILE--
  4. <?php
  5. class Bar {
  6. const Y = 20;
  7. }
  8. class Foo extends Bar {
  9. const X = 12;
  10. public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
  11. }
  12. $clazz = new ReflectionClass('Foo');
  13. $method = $clazz->getMethod('x');
  14. foreach ($method->getParameters() as $param) {
  15. if ( $param->isDefaultValueAvailable())
  16. echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n";
  17. }
  18. ?>
  19. --EXPECT--
  20. $x : 1
  21. $y : array (
  22. 0 => 12,
  23. )
  24. $z : 20