lsb_010.phpt 828 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. ZE2 Late Static Binding using static:: in functions called by non execute() calls and constructors.
  3. --FILE--
  4. <?php
  5. class Foo {
  6. protected static $className = 'Foo';
  7. public static function bar() {
  8. echo static::$className . "::bar\n";
  9. }
  10. public function __construct() {
  11. echo static::$className . "::__construct\n";
  12. }
  13. public function __destruct() {
  14. echo static::$className . "::__destruct\n";
  15. }
  16. }
  17. class FooChild extends Foo {
  18. protected static $className = 'FooChild';
  19. }
  20. register_shutdown_function(array('Foo', 'bar'));
  21. register_shutdown_function(array('FooChild', 'bar'));
  22. $foo = new Foo();
  23. $fooChild = new FooChild();
  24. unset($foo);
  25. unset($fooChild);
  26. ?>
  27. --EXPECT--
  28. Foo::__construct
  29. FooChild::__construct
  30. Foo::__destruct
  31. FooChild::__destruct
  32. Foo::bar
  33. FooChild::bar