Add basic compatibility w/ PHP 7 Exception hierarchie
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 6 Aug 2015 16:31:49 +0000 (18:31 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 6 Aug 2015 16:31:49 +0000 (18:31 +0200)
wcfsetup/install/files/lib/system/WCF.class.php

index daadb77e8c2868ab7682abf38c1b1fe70708fde9..a25d44ae90a14ebff087c02646ef9f0df2b31c63 100644 (file)
@@ -268,8 +268,10 @@ class WCF {
         * 
         * @param       \Exception      $e
         */
-       public static final function handleException(\Exception $e) {
+       public static final function handleException($e) {
                try {
+                       if (!($e instanceof \Exception)) throw $e;
+                       
                        if ($e instanceof IPrintableException) {
                                $e->show();
                                exit;
@@ -278,6 +280,9 @@ class WCF {
                        // repack Exception
                        self::handleException(new SystemException($e->getMessage(), $e->getCode(), '', $e));
                }
+               catch (\Throwable $exception) {
+                       die("<pre>WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
+               }
                catch (\Exception $exception) {
                        die("<pre>WCF::handleException() Unhandled exception: ".$exception->getMessage()."\n\n".$exception->getTraceAsString());
                }