php-src/ext/session/tests/019.phpt

75 lines
991 B
Plaintext
Raw Normal View History

--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
session.cache_limiter=
session.serialize_handler=php
session.save_handler=files
--FILE--
<?php
error_reporting(E_ALL);
class TFoo {
public $c;
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"];
session_write_close();
2010-04-21 09:27:22 +08:00
unset($_SESSION["o1"]);
unset($_SESSION["o2"]);
session_start();
var_dump($_SESSION);
2010-04-21 09:27:22 +08:00
$_SESSION["o1"]->inc();
$_SESSION["o2"]->inc();
var_dump($_SESSION);
session_destroy();
?>
--EXPECTF--
2009-05-06 02:19:16 +08:00
array(2) {
["o1"]=>
2003-12-23 07:17:17 +08:00
&object(TFoo)#%d (1) {
["c"]=>
int(42)
}
["o2"]=>
2003-12-23 07:17:17 +08:00
&object(TFoo)#%d (1) {
["c"]=>
int(42)
}
}
array(2) {
["o1"]=>
2003-12-23 07:17:17 +08:00
&object(TFoo)#%d (1) {
["c"]=>
int(44)
}
["o2"]=>
2003-12-23 07:17:17 +08:00
&object(TFoo)#%d (1) {
["c"]=>
int(44)
}
}
2009-05-06 02:19:16 +08:00