diff --git a/extension/qfq/qfq/exceptions/AbstractException.php b/extension/qfq/qfq/exceptions/AbstractException.php index c5c2d17203497fd6e43c25913d17044eb524c8d2..acd1939bea982f5a04d4f44feef8e5a0f7980c91 100644 --- a/extension/qfq/qfq/exceptions/AbstractException.php +++ b/extension/qfq/qfq/exceptions/AbstractException.php @@ -9,6 +9,7 @@ namespace qfq; require_once(__DIR__ . '/../../qfq/store/Store.php'); +require_once(__DIR__ . '/UserFormException.php'); class AbstractException extends \Exception { @@ -25,7 +26,13 @@ class AbstractException extends \Exception { */ public function formatException() { $debug = ''; - $store = Store::getInstance(); + try { + // In a very early stage, it might be possible that Store can't be initialized: take care not to use it. + $store = Store::getInstance(); + } catch (UserFormException $e) { + $store = null; + } + $html = ''; $this->messageArray['File'] = $this->getFile(); @@ -33,8 +40,10 @@ class AbstractException extends \Exception { $this->messageArray['Message'] = $this->getMessage(); $this->messageArray['Code'] = $this->getCode(); $this->messageArray['Stacktrace'] = '<pre>' . $this->getTraceAsString() . '</pre>'; - $this->messageArray['Page Id'] = $store->getVar(TYPO3_PAGE_ID, STORE_TYPO3); - $this->messageArray['Content Id'] = $store->getVar(TYPO3_TT_CONTENT_UID, STORE_TYPO3); + if ($store !== null) { + $this->messageArray['Page Id'] = $store->getVar(TYPO3_PAGE_ID, STORE_TYPO3); + $this->messageArray['Content Id'] = $store->getVar(TYPO3_TT_CONTENT_UID, STORE_TYPO3); + } $html .= "Code: " . $this->messageArray['Code'] . "<br>"; $html .= "Message: " . Support::wrapTag("<strong>", $this->messageArray['Message']) . "</br>"; @@ -50,7 +59,7 @@ class AbstractException extends \Exception { $html = "<h2>Error</h2>" . Support::wrapTag('<p>', $html); $html = Support::wrapTag("<div class='warning'>", $html); - if ($store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') { + if ($store !== null && $store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') { // Layout $debug = '<tr bgcolor="#dddddd"><td colspan="2">Exception</td></tr>';