diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-15 15:15:14 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-15 15:15:14 +0000 |
commit | 1b79da954c8d82793918c6b6675ef309f0efcbee (patch) | |
tree | f71d73efedd1a026f6ed4704398617cae89c77b6 /tests | |
parent | 3b547e6fc4296ee3b1cf5046a4d6e43326b78384 (diff) | |
download | php-git-1b79da954c8d82793918c6b6675ef309f0efcbee.tar.gz |
Added test case for bug #22231
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lang/bug22231.phpt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/lang/bug22231.phpt b/tests/lang/bug22231.phpt new file mode 100644 index 0000000000..0d4d19d2e5 --- /dev/null +++ b/tests/lang/bug22231.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #22231 (segfault when returning a global variable by reference) +--FILE-- +<?php +class foo { + var $fubar = 'fubar'; +} + +function &foo(){ + $GLOBALS['foo'] = &new foo(); + return $GLOBALS['foo']; +} +$bar = &foo(); +var_dump($bar); +var_dump($bar->fubar); +unset($bar); +$bar = &foo(); +var_dump($bar->fubar); + +$foo = &foo(); +var_dump($foo); +var_dump($foo->fubar); +unset($foo); +$foo = &foo(); +var_dump($foo->fubar); +?> +--EXPECT-- +object(foo)(1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" +object(foo)(1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" |