Don't exit too quickly when reporting an exception.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 9 Sep 2012 13:12:02 +0000 (15:12 +0200)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 9 Sep 2012 13:12:02 +0000 (15:12 +0200)
MWExceptionHander::handle() already exist at the end of its task,
so there's no need to have other die() calls.

There were some problems with that:
- wfLogProfilingData() was only called after reporting some exception
- MWExceptionHandler::report() was not consistent between web and
  command-linerequests
- MWException::reportHTML() was also not consistent when using the
  OutputPage object or not

Also removed MWExceptionHander::escapeEchoAndDie() since it's not needed anymore.

Change-Id: Ibb679c425ef0271a65f623c7b8541ec9bec70eb0

includes/Exception.php

index a131cca..714f73e 100644 (file)
@@ -240,7 +240,6 @@ class MWException extends Exception {
                        }
 
                        echo "</body></html>\n";
-                       die( 1 );
                }
        }
 
@@ -639,7 +638,7 @@ class MWExceptionHandler {
                                if ( $cmdLine ) {
                                        self::printError( $message );
                                } else {
-                                       self::escapeEchoAndDie( $message );
+                                       echo nl2br( htmlspecialchars( $message ) ) . "\n";
                                }
                        }
                } else {
@@ -653,7 +652,7 @@ class MWExceptionHandler {
                        if ( $cmdLine ) {
                                self::printError( $message );
                        } else {
-                               self::escapeEchoAndDie( $message );
+                               echo nl2br( htmlspecialchars( $message ) ) . "\n";
                        }
                }
        }
@@ -674,17 +673,6 @@ class MWExceptionHandler {
                }
        }
 
-       /**
-        * Print a message after escaping it and converting newlines to <br>
-        * Use this for non-command line failures.
-        *
-        * @param $message string Failure text
-        */
-       private static function escapeEchoAndDie( $message ) {
-               echo nl2br( htmlspecialchars( $message ) ) . "\n";
-               die(1);
-       }
-
        /**
         * Exception handler which simulates the appropriate catch() handling:
         *