incompat_ctx_user.phpt 373 B

1234567891011121314151617181920
  1. --TEST--
  2. Incompatible context call (non-internal function)
  3. --FILE--
  4. <?php
  5. class A {
  6. function foo() { var_dump(get_class($this)); }
  7. }
  8. class B {
  9. function bar() { A::foo(); }
  10. }
  11. $b = new B;
  12. try {
  13. $b->bar();
  14. } catch (Throwable $e) {
  15. echo "Exception: " . $e->getMessage() . "\n";
  16. }
  17. ?>
  18. --EXPECT--
  19. Exception: Non-static method A::foo() cannot be called statically