[BUGFIX] Disclose exceptions on CLI in production context 15/45315/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 16 Dec 2015 13:49:40 +0000 (14:49 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 17 Dec 2015 11:16:04 +0000 (12:16 +0100)
It is pointless to hide the exception message on CLI
in the production context. On CLI there are privileged
users only anyway and hiding this information from them
leads to wasted hours of debugging.

Output the necessary information also in ProductionExceptionHandler

Resolves: #72265
Releases: master, 6.2
Change-Id: I778b057fc7e170af2a2fcdb1befb2a4400449ce7
Reviewed-on: https://review.typo3.org/45315
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Cedric Ziel <cedric@cedric-ziel.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php

index d51fab7..de8023e 100644 (file)
@@ -69,7 +69,15 @@ class ProductionExceptionHandler extends AbstractExceptionHandler
      */
     public function echoExceptionCLI(\Exception $exception)
     {
+        $filePathAndName = $exception->getFile();
+        $exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
         $this->writeLogEntries($exception, self::CONTEXT_CLI);
+        echo '
+Uncaught TYPO3 Exception ' . $exceptionCodeNumber . $exception->getMessage() . LF;
+        echo 'thrown in file ' . $filePathAndName . LF;
+        echo 'in line ' . $exception->getLine() . '
+
+';
         die(1);
     }