bug39003.phpt 525 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Bug #39003 (autoloader is called for type hinting)
  3. --FILE--
  4. <?php
  5. class ClassName
  6. {
  7. public $var = 'bla';
  8. }
  9. function test (OtherClassName $object) { }
  10. spl_autoload_register(function ($class) {
  11. var_dump("__autload($class)");
  12. });
  13. $obj = new ClassName;
  14. test($obj);
  15. echo "Done\n";
  16. ?>
  17. --EXPECTF--
  18. Fatal error: Uncaught TypeError: test(): Argument #1 ($object) must be of type OtherClassName, ClassName given, called in %s:%d
  19. Stack trace:
  20. #0 %s(%d): test(Object(ClassName))
  21. #1 {main}
  22. thrown in %s on line %d