2002-10-03 22:54:15 +00:00
|
|
|
--TEST--
|
|
|
|
serializing references test case using globals
|
|
|
|
--SKIPIF--
|
|
|
|
<?php include('skipif.inc'); ?>
|
|
|
|
--INI--
|
|
|
|
session.use_cookies=0
|
|
|
|
session.cache_limiter=
|
|
|
|
register_globals=1
|
2002-11-25 23:20:05 +00:00
|
|
|
session.serialize_handler=php
|
2005-07-04 13:09:14 +00:00
|
|
|
session.save_handler=files
|
2002-10-03 22:54:15 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
|
|
|
class TFoo {
|
2003-11-30 13:57:20 +00:00
|
|
|
public $c;
|
2002-10-03 22:54:15 +00:00
|
|
|
function TFoo($c) {
|
|
|
|
$this->c = $c;
|
|
|
|
}
|
|
|
|
function inc() {
|
|
|
|
$this->c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
session_id("abtest");
|
|
|
|
session_start();
|
2003-06-13 09:19:52 +00:00
|
|
|
session_register('o1', 'o2' );
|
2002-10-03 22:54:15 +00:00
|
|
|
|
2004-02-05 09:03:37 +00:00
|
|
|
$o1 = new TFoo(42);
|
2002-10-03 22:54:15 +00:00
|
|
|
$o2 =& $o1;
|
|
|
|
|
|
|
|
session_write_close();
|
|
|
|
|
|
|
|
unset($o1);
|
|
|
|
unset($o2);
|
|
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
var_dump($_SESSION);
|
|
|
|
|
|
|
|
$o1->inc();
|
|
|
|
$o2->inc();
|
|
|
|
|
|
|
|
var_dump($_SESSION);
|
|
|
|
|
|
|
|
session_destroy();
|
|
|
|
?>
|
2003-06-13 09:15:56 +00:00
|
|
|
--EXPECTF--
|
2002-10-03 22:54:15 +00:00
|
|
|
array(2) {
|
|
|
|
["o1"]=>
|
2003-12-22 23:17:17 +00:00
|
|
|
&object(TFoo)#%d (1) {
|
2002-10-03 22:54:15 +00:00
|
|
|
["c"]=>
|
|
|
|
int(42)
|
|
|
|
}
|
|
|
|
["o2"]=>
|
2003-12-22 23:17:17 +00:00
|
|
|
&object(TFoo)#%d (1) {
|
2002-10-03 22:54:15 +00:00
|
|
|
["c"]=>
|
|
|
|
int(42)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
array(2) {
|
|
|
|
["o1"]=>
|
2003-12-22 23:17:17 +00:00
|
|
|
&object(TFoo)#%d (1) {
|
2002-10-03 22:54:15 +00:00
|
|
|
["c"]=>
|
|
|
|
int(44)
|
|
|
|
}
|
|
|
|
["o2"]=>
|
2003-12-22 23:17:17 +00:00
|
|
|
&object(TFoo)#%d (1) {
|
2002-10-03 22:54:15 +00:00
|
|
|
["c"]=>
|
|
|
|
int(44)
|
|
|
|
}
|
|
|
|
}
|