File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
Zend /
tests /
bug38287.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
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>