<?php
function throwWithFinalAndCatch() {
try {
echo 'One'.PHP_EOL;
throw new \Exception();
} catch( \Exception $e ) {
$exception = $e;
} finally {
echo 'Two'.PHP_EOL;
}
if ( $exception ) {
throw $exception;
}
}
function throwWithFinal() {
try {
echo 'One'.PHP_EOL;
throw new \Exception();
} finally {
echo 'Two'.PHP_EOL;
}
}
try {
throwWithFinalAndCatch();
} catch (\Exception $e) {}
try {
throwWithFinal();
} catch (\Exception $e) {}
PD9waHAKCmZ1bmN0aW9uIHRocm93V2l0aEZpbmFsQW5kQ2F0Y2goKSB7Cgl0cnkgewoJCWVjaG8gJ09uZScuUEhQX0VPTDsKCQl0aHJvdyBuZXcgXEV4Y2VwdGlvbigpOyAKCX0gY2F0Y2goIFxFeGNlcHRpb24gJGUgKSB7CgkJJGV4Y2VwdGlvbiA9ICRlOwoJfSBmaW5hbGx5IHsKCQllY2hvICdUd28nLlBIUF9FT0w7Cgl9CgkKCWlmICggJGV4Y2VwdGlvbiApIHsKCQl0aHJvdyAkZXhjZXB0aW9uOwoJfQp9CgoKZnVuY3Rpb24gdGhyb3dXaXRoRmluYWwoKSB7Cgl0cnkgewoJCWVjaG8gJ09uZScuUEhQX0VPTDsKCQl0aHJvdyBuZXcgXEV4Y2VwdGlvbigpOyAKCX0gZmluYWxseSB7CgkJZWNobyAnVHdvJy5QSFBfRU9MOwoJfQp9Cgp0cnkgewoJdGhyb3dXaXRoRmluYWxBbmRDYXRjaCgpOwkKfSBjYXRjaCAoXEV4Y2VwdGlvbiAkZSkge30KCgp0cnkgewoJdGhyb3dXaXRoRmluYWwoKTsJCn0gY2F0Y2ggKFxFeGNlcHRpb24gJGUpIHt9Cgo=