File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug64896.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 08:02:49 2013 UTC (11 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, HEAD
v 5.4.20

    1: --TEST--
    2: Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects)
    3: --XFAIL--
    4: We can not fix this bug without a significant (performace slow down) change to gc
    5: --FILE--
    6: <?php
    7: $bar = NULL;
    8: class bad
    9: {
   10: 	private $_private = array();
   11: 
   12: 	public function __construct()
   13: 	{
   14: 		$this->_private[] = 'php';
   15: 	}
   16: 
   17: 	public function __destruct()
   18: 	{
   19: 		global $bar;
   20: 		$bar = $this;
   21: 	}
   22: }
   23: 
   24: $foo = new stdclass;
   25: $foo->foo = $foo;
   26: $foo->bad = new bad;
   27: 
   28: gc_disable();
   29: 
   30: unserialize(serialize($foo));
   31: gc_collect_cycles();
   32: var_dump($bar); 
   33: /*  will output:
   34: object(bad)#4 (1) {
   35:   ["_private":"bad":private]=>
   36:   &UNKNOWN:0
   37: }
   38: */
   39: ?>
   40: --EXPECTF--
   41: bject(bad)#%d (1) {
   42:   ["_private":"bad":private]=>
   43:   array(1) {
   44:     [0]=>
   45:     string(3) "php"
   46:   }
   47: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>