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