{"id":1994,"date":"2022-08-30T15:21:10","date_gmt":"2022-08-30T15:21:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/08\/using-an-exception-to-exit-php-application-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:21:10","modified_gmt":"2022-08-30T15:21:10","slug":"using-an-exception-to-exit-php-application-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/using-an-exception-to-exit-php-application-collection-of-common-programming-errors\/","title":{"rendered":"Using an Exception to Exit PHP Application-Collection of common programming errors"},"content":{"rendered":"<p>My app has a registered shutdown function and it seems there&#8217;s some issues with that and my method of using an exception with a try\/catch to exit the application (instead of using the exit() method due to FastCGI not liking this).<\/p>\n<p>My problem is that if another exception is thrown in the try\/catch block that isn&#8217;t the ExitApp exception, it causes some unexpected results and the end result is the ExitApp exception isn&#8217;t caught.<\/p>\n<p>I&#8217;m seeing this on PHP 5.3.6, going to test it on another version now, but I&#8217;m curious if anyone can immediately point out what&#8217;s wrong here.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-08 05:39:58. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>My app has a registered shutdown function and it seems there&#8217;s some issues with that and my method of using an exception with a try\/catch to exit the application (instead of using the exit() method due to FastCGI not liking this). My problem is that if another exception is thrown in the try\/catch block that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1994","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1994"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1994\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}