1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/standard/tests/serialize/bug14293.phpt
2025-10-06 10:30:27 +02:00

37 lines
572 B
PHP

--TEST--
Bug #14293 (serialize() and __sleep())
--FILE--
<?php
class t
{
public $a;
function __construct()
{
$this->a = 'hello';
}
function __sleep()
{
echo "__sleep called\n";
return array('a','b');
}
}
$t = new t();
$data = serialize($t);
echo "$data\n";
$t = unserialize($data);
var_dump($t);
?>
--EXPECTF--
__sleep called
Warning: serialize(): "b" returned as member variable from __sleep() but does not exist in %s on line %d
O:1:"t":1:{s:1:"a";s:5:"hello";}
object(t)#%d (1) {
["a"]=>
string(5) "hello"
}