bug47054.phpt 710 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Bug #47054 (BC break in static functions called as dynamic)
  3. --FILE--
  4. <?php
  5. class C {
  6. final static function s() {
  7. print "Called class: " . get_called_class() . "\n";
  8. }
  9. }
  10. class D extends C {
  11. public function m() {
  12. $this->s();
  13. }
  14. }
  15. $d = new D();
  16. $d->m();
  17. C::s();
  18. $c = new C();
  19. $c->s();
  20. get_called_class();
  21. D::m();
  22. ?>
  23. --EXPECTF--
  24. Called class: D
  25. Called class: C
  26. Called class: C
  27. Warning: get_called_class() called from outside a class in %s on line %d
  28. Deprecated: Non-static method D::m() should not be called statically in %s on line %d
  29. Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
  30. Stack trace:
  31. #0 %s(%d): D::m()
  32. #1 {main}
  33. thrown in %s on line %d