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/sleep_undefined_declared_properties.phpt
2025-10-06 10:30:27 +02:00

30 lines
724 B
PHP

--TEST--
__sleep() returning undefined declared properties
--FILE--
<?php
class Test {
public $pub;
protected $prot;
private $priv;
public function __construct() {
unset($this->pub, $this->prot, $this->priv);
}
public function __sleep() {
return ['pub', 'prot', 'priv'];
}
}
var_dump(serialize(new Test));
?>
--EXPECTF--
Warning: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d
Warning: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d
Warning: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d
string(15) "O:4:"Test":0:{}"