1--TEST-- 2Bug #31177 (memory corruption because of incorrect refcounting) 3--FILE-- 4<?php 5class foo { 6 function __construct($n=0) { 7 if($n) throw new Exception("new"); 8 } 9} 10$x = new foo(); 11try { 12 $y=$x->__construct(1); 13} catch (Exception $e) { 14 var_dump($x); 15} 16?> 17--EXPECT-- 18object(foo)#1 (0) { 19} 20