1--TEST-- 2Bug #52361 (Throwing an exception in a destructor causes invalid catching) 3--FILE-- 4<?php 5class aaa { 6 public function __destruct() { 7 try { 8 throw new Exception(__CLASS__); 9 } catch(Exception $ex) { 10 echo "1. $ex\n"; 11 } 12 } 13} 14function bbb() { 15 $a = new aaa(); 16 throw new Exception(__FUNCTION__); 17} 18try { 19 bbb(); 20 echo "must be skipped !!!"; 21} catch(Exception $ex) { 22 echo "2. $ex\n"; 23} 24?> 25--EXPECTF-- 261. Exception: aaa in %sbug52361.php:5 27Stack trace: 28#0 %sbug52361.php(13): aaa->__destruct() 29#1 %sbug52361.php(16): bbb() 30#2 {main} 312. Exception: bbb in %sbug52361.php:13 32Stack trace: 33#0 %sbug52361.php(16): bbb() 34#1 {main} 35