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 #2

Updated by Benni Mack over 1 year ago

Some interesting facts:
  • Abstract Menu Code in v11/v12 was changed, and the affected code was not in place anymore.
  • PageRepository->getPage() already does a versionOL() under the hood

Apart from that, I will add the guard clause.

Actions #3

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79718

Actions #4

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79718

Actions #5

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79718

Actions #6

Updated by Gerrit Code Review over 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79718

Actions #7

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79738

Actions #8

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79739

Actions #9

Updated by Benni Mack over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Gerrit Code Review over 1 year ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79739

Actions #11

Updated by Benni Mack over 1 year ago

  • Status changed from Under Review to Resolved
Actions #12

Updated by Oliver Bartsch over 1 year ago

  • Related to Bug #101250: PHPStan error in PageRepository added
Actions #13

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF