indirect_call_string_002.phpt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --TEST--
  2. Indirect call with empty class and/or method name.
  3. --FILE--
  4. <?php
  5. class TestClass
  6. {
  7. public static function __callStatic($method, array $args)
  8. {
  9. var_dump($method);
  10. }
  11. }
  12. // Test call using array syntax
  13. $callback = ['TestClass', ''];
  14. $callback();
  15. // Test call using Class::method syntax.
  16. $callback = 'TestClass::';
  17. $callback();
  18. // Test array syntax with empty class name
  19. $callback = ['', 'method'];
  20. try {
  21. $callback();
  22. } catch (Error $e) {
  23. echo $e->getMessage() . "\n";
  24. }
  25. // Test Class::method syntax with empty class name
  26. $callback = '::method';
  27. try {
  28. $callback();
  29. } catch (Error $e) {
  30. echo $e->getMessage() . "\n";
  31. }
  32. // Test array syntax with empty class and method name
  33. $callback = ['', ''];
  34. try {
  35. $callback();
  36. } catch (Error $e) {
  37. echo $e->getMessage() . "\n";
  38. }
  39. // Test Class::method syntax with empty class and method name
  40. $callback = '::';
  41. try {
  42. $callback();
  43. } catch (Error $e) {
  44. echo $e->getMessage() . "\n";
  45. }
  46. // Test string ending in single colon
  47. $callback = 'Class:';
  48. try {
  49. $callback();
  50. } catch (Error $e) {
  51. echo $e->getMessage() . "\n";
  52. }
  53. // Test string beginning in single colon
  54. $callback = ':method';
  55. try {
  56. $callback();
  57. } catch (Error $e) {
  58. echo $e->getMessage() . "\n";
  59. }
  60. // Test single colon
  61. $callback = ':';
  62. try {
  63. $callback();
  64. } catch (Error $e) {
  65. echo $e->getMessage() . "\n";
  66. }
  67. ?>
  68. --EXPECT--
  69. string(0) ""
  70. string(0) ""
  71. Class "" not found
  72. Class "" not found
  73. Class "" not found
  74. Class "" not found
  75. Call to undefined function Class:()
  76. Call to undefined function :method()
  77. Call to undefined function :()