We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b547e6 commit 1b79da9Copy full SHA for 1b79da9
tests/lang/bug22231.phpt
@@ -0,0 +1,39 @@
1
+--TEST--
2
+Bug #22231 (segfault when returning a global variable by reference)
3
+--FILE--
4
+<?php
5
+class foo {
6
+ var $fubar = 'fubar';
7
+}
8
+
9
+function &foo(){
10
+ $GLOBALS['foo'] = &new foo();
11
+ return $GLOBALS['foo'];
12
13
+$bar = &foo();
14
+var_dump($bar);
15
+var_dump($bar->fubar);
16
+unset($bar);
17
18
19
20
+$foo = &foo();
21
+var_dump($foo);
22
+var_dump($foo->fubar);
23
+unset($foo);
24
25
26
+?>
27
+--EXPECT--
28
+object(foo)(1) {
29
+ ["fubar"]=>
30
+ string(5) "fubar"
31
32
+string(5) "fubar"
33
34
35
36
37
38
39
0 commit comments