2003-02-15 15:15:14 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #22231 (segfault when returning a global variable by reference)
|
2005-04-29 01:18:41 +00:00
|
|
|
--INI--
|
|
|
|
error_reporting=4095
|
2003-02-15 15:15:14 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class foo {
|
2003-11-30 13:57:20 +00:00
|
|
|
public $fubar = 'fubar';
|
2003-02-15 15:15:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
?>
|
2003-03-10 20:46:39 +00:00
|
|
|
--EXPECTF--
|
2004-02-10 15:20:51 +00:00
|
|
|
Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d
|
2003-03-10 20:46:39 +00:00
|
|
|
object(foo)#%d (1) {
|
2003-02-15 15:15:14 +00:00
|
|
|
["fubar"]=>
|
|
|
|
string(5) "fubar"
|
|
|
|
}
|
|
|
|
string(5) "fubar"
|
|
|
|
string(5) "fubar"
|
2003-03-10 20:46:39 +00:00
|
|
|
object(foo)#%d (1) {
|
2003-02-15 15:15:14 +00:00
|
|
|
["fubar"]=>
|
|
|
|
string(5) "fubar"
|
|
|
|
}
|
|
|
|
string(5) "fubar"
|
|
|
|
string(5) "fubar"
|