Bug #104812
open
Undefined array key exception in ReferenceIndex.php:765
Added by Thomas Sam Wittich about 2 months ago.
Updated about 2 months ago.
Description
Dears, in Typo3 11 is asummingly non-null-safe exception when a array key is missing:
[2024-09-04 04:10:24 CEST]
[2024-09-04 04:10:24 CEST] [ERROR] PHP Warning: Undefined array key 1 in
[2024-09-04 04:10:24 CEST] /home/p-aaaaaa/html/typo3-project/public/typo3/sysext/core/C
[2024-09-04 04:10:24 CEST] lasses/Database/ReferenceIndex.php line 765
[2024-09-04 04:10:24 CEST]
[2024-09-04 04:10:24 CEST] Exit-Code: 1
The mentioned line hold an if-statment without checking the existence of the array-keys in the condition.
It occured with TYPO3 v11 latest and within the cron, cli scheduler:run.
Please investigate.
Thank you, Sam
- Category changed from CLI to Backend API
- Status changed from New to Needs Feedback
- Tags set to refindex
Do you have a way to reproduce this? From what I read the code this line:
if ((int)$itemArray[$refRec['sorting']]['id'] === (int)$refRec['ref_uid'] && (string)$itemArray[$refRec['sorting']]['table'] === (string)$refRec['ref_table']) {
triggers it, proably specifically $refRec['sorting'] resolving to '1' and then the array key access on $itemArray1 failing.
I have the feeling this should not simply be an array key guard check, but in fact data integrity is a problem here. If you could provide a reproducible example for it, or are able to inspect what $itemArray and $refRec looks like when the error is triggered, that would help.
FYI, in TYPO3v13 this method has been moved to typo3/sysext/lowlevel/Classes/Command/MissingRelationsCommand.php
Hi Garvin,
thank you investigating in that.
I did a DDEV-clone of the whole site to reproduce it locally.
But here, the error does not appear.
Do you have any advice howto enable debug-output on the CLI at the remote server?
Do the TYPO3-Debug-Settings help here?
Thanks for getting back!
The best way would be to try enabling the Development context (see https://usetypo3.com/application-context/ for example), that also enables the Debug FE/BE modes, and should apply to CLI.
Does the error reprodudibly happen for you when you run the CLI task? Then you could try this:
TYPO3_CONTEXT=Development vendor/bin/typo3 referencindex:update
(Or run the scheduler this way, don't know which exact job you use and if the symfony command exists in your version, cannot look it up atm)
Then it should apply only to that singular call, and not enable dev mode on a possible production site...
Also available in: Atom
PDF