Skip to content
Snippets Groups Projects
Commit 39a5de46 authored by Stephan Großberndt's avatar Stephan Großberndt Committed by Oliver Bartsch
Browse files

[BUGFIX] Avoid exception for recent documents

Backend no longer crashes with an TableNotFoundException if a
table has been removed and an according item is in the list
of recent documents.

The patch catches the exception.

Releases: main, 12.4, 11.5
Resolves: #101139
Change-Id: I489d8cf1ee2bb10800fe2966ae4fc1cb0bcd57c5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79852


Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
parent 4038aabd
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Opendocs\Backend\ToolbarItems;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Domain\Model\Element\ImmediateActionElement;
use TYPO3\CMS\Backend\Routing\UriBuilder;
......@@ -140,7 +141,17 @@ class OpendocsToolbarItem implements ToolbarItemInterface, RequestAwareToolbarIt
{
$table = $document[3]['table'] ?? '';
$uid = $document[3]['uid'] ?? 0;
$record = BackendUtility::getRecordWSOL($table, $uid);
try {
$record = BackendUtility::getRecordWSOL($table, $uid);
} catch (TableNotFoundException) {
// This exception is caught in cases, when you have an recently opened document
// from an extension record (let's say a sys_note record) and then uninstall
// the extension and drop the DB table. After then, the DB table could
// not be found anymore and will throw an exception making the
// whole backend unusable.
$record = null;
}
if (!is_array($record)) {
// Record seems to be deleted
......
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