Bug #98189
closedSQL-Error with empty row in versionOL()
100%
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
Updated by Alexander Schnitzler about 2 years ago
Updated by Benni Mack over 1 year ago
- 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.
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
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
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
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
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
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
Updated by Benni Mack over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f79fda4dfeb41956113d62f6985d6c6e68d7b708.
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
Updated by Benni Mack over 1 year ago
- Status changed from Under Review to Resolved
Applied in changeset af71af97f251d3d019beaf74616a6c6cb95ad58b.
Updated by Oliver Bartsch over 1 year ago
- Related to Bug #101250: PHPStan error in PageRepository added