objects_025.phpt 689 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Testing invalid method names with __call and __callstatic
  3. --FILE--
  4. <?php
  5. class foo {
  6. public function __call($a, $b) {
  7. print "non-static - ok\n";
  8. }
  9. public static function __callstatic($a, $b) {
  10. print "static - ok\n";
  11. }
  12. }
  13. $a = new foo;
  14. $a->foooo();
  15. $a::foooo();
  16. $b = 'aaaaa1';
  17. $a->$b();
  18. $a::$b();
  19. $b = ' ';
  20. $a->$b();
  21. $a::$b();
  22. $b = str_repeat('a', 10000);
  23. $a->$b();
  24. $a::$b();
  25. $b = NULL;
  26. $a->$b();
  27. ?>
  28. --EXPECTF--
  29. non-static - ok
  30. static - ok
  31. non-static - ok
  32. static - ok
  33. non-static - ok
  34. static - ok
  35. non-static - ok
  36. static - ok
  37. Fatal error: Uncaught Error: Method name must be a string in %s:%d
  38. Stack trace:
  39. #0 {main}
  40. thrown in %s on line %d