incompat_ctx_user.phpt 441 B

123456789101112131415161718192021
  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. --EXPECTF--
  19. Deprecated: Non-static method A::foo() should not be called statically in %s on line %d
  20. Exception: Using $this when not in object context