bug47054.phpt 641 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. Strict Standards: Non-static method D::m() should not be called statically in %s on line %d
  29. Fatal error: Using $this when not in object context in %s on line %d