summaryrefslogtreecommitdiff
path: root/Zend/tests/static_variable_in_private_trait_method.phpt
blob: 0d842c857c0053f7cb6d73dad31551c15313444f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Behavior of static variable in private trait method
--FILE--
<?php

trait T {
    private static function method() {
        static $x;
        if ($x === null) $x = new stdClass;
        return $x;
    }

    public static function method2() {
        return self::method();
    }
}

class C {
    use T;
}

var_dump(C::method2());

class D extends C {
    use T;
}

var_dump(D::method2());

?>
--EXPECT--
object(stdClass)#1 (0) {
}
object(stdClass)#2 (0) {
}