Annotation of embedaddon/php/Zend/tests/bug38287.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #38287 (static variables mess up global vars)
3: --FILE--
4: <?php
5: error_reporting(0);
6:
7: something::do_something();
8:
9: // $not_there is really NULL
10: var_dump($not_there);
11:
12: // error occurs here: execution should never get inside the if condition because $not_there is NULL
13: if ($not_there["invalid_var"]) {
14: // will print NULL (which is ok, but execution should never get here if the value is NULL)
15: var_dump($not_there["use_authmodule"]);
16: // will print "PATH:Array"
17: print "PATH:".$not_there["use_authmodule"]."\n";
18: }
19:
20: class something {
21: public static function get_object() {
22: static $object=NULL;
23: if ($object===NULL)
24: $object=new something;
25: return $object;
26: }
27:
28: public static function do_something() {
29: self::get_object()->vars[]=1;
30: self::get_object()->vars[]=2;
31: self::get_object()->vars[]=3;
32: var_dump(self::get_object()->vars);
33: }
34: }
35: ?>
36: --EXPECT--
37: array(3) {
38: [0]=>
39: int(1)
40: [1]=>
41: int(2)
42: [2]=>
43: int(3)
44: }
45: NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>