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