Skip to content
Snippets Groups Projects
Commit 0263b8d8 authored by Daniel Siepmann's avatar Daniel Siepmann Committed by Anja Leichsenring
Browse files

[BUGFIX] Prevent exception on missing sys_csp_resolution table

Ignore missing sys_csp_resolution table and return empty
result instead of breaking the installation.

Resolves: #101570
Releases: main, 12.4
Change-Id: Id6834e5c0fdb530a2f2fb3a90bef4c223bed1734
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80358


Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 35157fba
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Security\ContentSecurityPolicy\Reporting;
use Doctrine\DBAL\Exception\TableNotFoundException;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope;
......@@ -55,13 +56,21 @@ class ResolutionRepository
*/
public function findByScope(Scope $scope): array
{
$result = $this->getConnection()->select(
['*'],
self::TABLE_NAME,
['scope' => (string)$scope],
[],
['created' => 'asc']
);
try {
$result = $this->getConnection()->select(
['*'],
self::TABLE_NAME,
['scope' => (string)$scope],
[],
['created' => 'asc']
);
} catch (TableNotFoundException) {
// We usually don't take care of non-existing table throughout the system.
// This one however can happen when major upgrading TYPO3 and calling the
// backend first time. It is fair to catch this case to prevent forcing admins
// to unlock standalone install tool or to use cli to fix db schema.
return [];
}
return array_map(
static fn (array $row) => Resolution::fromArray($row),
$result->fetchAllAssociative()
......
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