abstract_user_call.phpt 523 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. ZE2 An abstract method cannot be called indirectly
  3. --FILE--
  4. <?php
  5. abstract class test_base
  6. {
  7. abstract function func();
  8. }
  9. class test extends test_base
  10. {
  11. function func()
  12. {
  13. echo __METHOD__ . "()\n";
  14. }
  15. }
  16. $o = new test;
  17. $o->func();
  18. try {
  19. call_user_func(array($o, 'test_base::func'));
  20. } catch (TypeError $e) {
  21. echo $e->getMessage(), "\n";
  22. }
  23. ?>
  24. --EXPECT--
  25. test::func()
  26. call_user_func(): Argument #1 ($callback) must be a valid callback, cannot call abstract method test_base::func()