abstract.phpt 550 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. ZE2 An abstract method may not be called
  3. --FILE--
  4. <?php
  5. abstract class fail {
  6. abstract function show();
  7. }
  8. class pass extends fail {
  9. function show() {
  10. echo "Call to function show()\n";
  11. }
  12. function error() {
  13. parent::show();
  14. }
  15. }
  16. $t = new pass();
  17. $t->show();
  18. $t->error();
  19. echo "Done\n"; // shouldn't be displayed
  20. ?>
  21. --EXPECTF--
  22. Call to function show()
  23. Fatal error: Uncaught Error: Cannot call abstract method fail::show() in %s:%d
  24. Stack trace:
  25. #0 %s(%d): pass->error()
  26. #1 {main}
  27. thrown in %s on line %d