php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64896
Patch bug64896.phpt revision 2013-08-30 10:09 UTC by arjen at react dot com

Patch bug64896.phpt for Reproducible crash Bug #64896

Patch version 2013-08-30 10:09 UTC

Return to Bug #64896 | Download this patch
Patch Revisions:

Developer: arjen@react.com

--TEST--
Segfault with gc_collect_cycles using unserialize on certain objects
--FILE--
<?php
class bad
{
	private $_private = array();

	public function __construct()
	{
		$this->_private[] = 'oh noes';
	}

	public function __destruct()
	{
		//echo "bad::destructor\n";

		global $bar;
		$bar = $this->_private;
	}
}

$foo = new stdclass;
$foo->foo = $foo;
$foo->bad = new bad;
print_r($foo);

gc_disable();

for ($i=0; $i < 10; $i++)
{
	$deep_clone = unserialize(serialize($foo));
	gc_collect_cycles();
	echo $i;
}
--EXPECT--
0123456789
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC