Skip to content
Snippets Groups Projects
Commit 7bc9a4e9 authored by Thomas Maroschik's avatar Thomas Maroschik Committed by Christian Kuhn
Browse files

[BUGFIX] Display detected fatal in extension check

In the installer fatals can happen during updates of
very outdated extensions. Many updates can lead to a
redirect to the extension check where the user gets
displayed a message that a fatal has been detected.
But the detected fatal error itself is not displayed.

This patch passes the error as url parameter to the
extension check and displays it there.

Fixes: #54943
Releases: 6.2
Change-Id: I111df5d5411015b21c4b2b5e9be3b83b311c8bc5
Reviewed-on: https://review.typo3.org/26781
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Thomas Maroschik
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Reviewed-by: Markus Klein
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent a246231c
Branches
Tags
No related merge requests found
......@@ -63,6 +63,11 @@ abstract class AbstractAction {
*/
protected $postValues = array();
/**
* @var array Contains the fatal error array of the last request when passed. Schema is the one returned by error_get_last()
*/
protected $lastError = array();
/**
* @var array<\TYPO3\CMS\Install\Status\StatusInterface> Optional status message from controller
*/
......@@ -103,6 +108,7 @@ abstract class AbstractAction {
->assign('token', $this->token)
->assign('context', $contextService->getContextString())
->assign('contextService', $contextService)
->assign('lastError', $this->lastError)
->assign('messages', $this->messages)
->assign('typo3Version', TYPO3_version)
->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])
......@@ -151,6 +157,15 @@ abstract class AbstractAction {
$this->postValues = $postValues;
}
/**
* Set the last error array as returned by error_get_last()
*
* @param array $lastError
*/
public function setLastError(array $lastError) {
$this->lastError = $lastError;
}
/**
* Status messages from controller
*
......
......@@ -69,6 +69,13 @@ interface ActionInterface {
*/
public function setPostValues(array $postValues);
/**
* Set the last error array as returned by error_get_last()
*
* @param array $lastError
*/
public function setLastError(array $lastError);
/**
* Status messages from controller
*
......
......@@ -129,6 +129,12 @@ class ToolController extends AbstractController {
// Add action if specified
$parameters[] = 'install[action]=loadExtensions';
// Add error to display a message what triggered the check
$errorEncoded = json_encode($error);
$parameters[] = 'install[lastError]=' . rawurlencode($errorEncoded);
// We do not use GeneralUtility here to be sure that hash generation works even if that class might not exist any more.
$parameters[] = 'install[lastErrorHash]=' . hash_hmac('sha1', $errorEncoded, $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . 'InstallToolError');
$redirectLocation = 'Install.php?' . implode('&', $parameters);
if (!headers_sent()) {
......@@ -148,6 +154,23 @@ class ToolController extends AbstractController {
});
}
/**
* Get last error values of install tool.
*
* @return array
*/
protected function getLastError() {
$getVars = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('install');
$lastError = array();
if (isset($getVars['lastError']) && isset($getVars['lastErrorHash']) && !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
$calculatedHash = hash_hmac('sha1', $getVars['lastError'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . 'InstallToolError');
if ($calculatedHash === $getVars['lastErrorHash']) {
$lastError = json_decode($getVars['lastError'], TRUE);
}
}
return $lastError;
}
/**
* Call an action that needs authentication
*
......@@ -173,6 +196,7 @@ class ToolController extends AbstractController {
$toolAction->setAction($action);
$toolAction->setToken($this->generateTokenForAction($action));
$toolAction->setPostValues($this->getPostValues());
$toolAction->setLastError($this->getLastError());
$this->output($toolAction->handle());
}
}
<f:if condition="{lastError}">
<div class="typo3-message message-warning">
<div class="header-container">
<div class="message-header">
<strong>Detected Fatal Error</strong>
</div>
<div class="message-body">
{lastError.message} in {lastError.file} on line {lastError.line}
</div>
</div>
</div>
</f:if>
\ No newline at end of file
......@@ -13,6 +13,8 @@
are unloaded, you can restart the initial action to proceed your request.
</p>
<f:render partial="Action/Tool/ImportantActions/LastError" arguments="{lastError: lastError}"/>
<hr />
<f:render partial="Action/Tool/ImportantActions/ExtensionCompatibilityTester" arguments="{_all}"/>
<script type="text/javascript">
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment