Project

General

Profile

Actions

Bug #98189

closed

SQL-Error with empty row in versionOL()

Added by Alexander Schnitzler about 2 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2022-08-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi,

after years, I tried workspaces again and I encountered the following issue:

SELECT FROM `pages` WHERE (`t3ver_oid` = ?) AND (`t3ver_wsid` = ?) AND (`pages`.`deleted` = 0) LIMIT 1' with params [0, 2]

The query is invalid due to the missing queried rows. This happens if
\TYPO3\CMS\Core\Domain\Repository\PageRepository::versionOL()

is called with empty $row and the following conditions doesn't guard the following logic enough:

if ($this->versioningWorkspaceId > 0 && is_array($row))

In my case it happens due to the following code in AbstractMenuContentObject.php:

if ($row['l10n_parent'] > 0 && !isset($row['_PAGES_OVERLAY'])) {
    $row = $this->sys_page->getPage($row['l10n_parent'], true);
}
$tsfe->sys_page->versionOL('pages', $row, true);

getPage() returns the empty array which is then passed along to versionOL().

I currently fixed it by extending the guard clause to also check for a non empty array:

if ($this->versioningWorkspaceId > 0 && is_array($row) && $row !== [])

Not sure though if this is a suitable long term solution.


Files


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #101250: PHPStan error in PageRepositoryClosed2023-07-05

Actions
Actions

Also available in: Atom PDF