mirror of
https://github.com/php/php-src.git
synced 2026-04-16 20:41:18 +02:00
The object that is being serialized may be destroyed during the execution of __sleep(), so operate on a copy instead.
17 lines
324 B
PHP
17 lines
324 B
PHP
--TEST--
|
|
Bug #73154: serialize object with __sleep function crash
|
|
--FILE--
|
|
<?php
|
|
class a {
|
|
public $a;
|
|
public function __sleep() {
|
|
$this->a=null;
|
|
return array();
|
|
}
|
|
}
|
|
$s = 'a:1:{i:0;O:1:"a":1:{s:1:"a";R:2;}}';
|
|
var_dump(serialize(unserialize($s)));
|
|
?>
|
|
--EXPECT--
|
|
string(22) "a:1:{i:0;O:1:"a":0:{}}"
|