#104812Undefined array key exception in ReferenceIndex.php:765
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
Reviews 3
Related issues 1
History 812
-
Garvin Hicking commented and changed category status
NewNeeds Feedback Tags refindex <span data-processor="relativetime" data-value="2024-09-04T10:10:34+00:00" > 09/04/24, 10:10 </span> -
Thomas Sam Wittich commented <span data-processor="relativetime" data-value="2024-09-05T08:52:03+00:00" > 09/05/24, 08:52 </span>
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?
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2024-09-05T09:21:44+00:00" > 09/05/24, 09:21 </span>
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…
-
Christian Kuhn changed Duplicated by #94562 <span data-processor="relativetime" data-value="2024-11-20T15:17:56+00:00" > 11/20/24, 15:17 </span>
-
Christian Kuhn commented <span data-processor="relativetime" data-value="2024-11-21T14:34:30+00:00" > 11/21/24, 14:34 </span>
this code is triggered by cleanup:missingrelations CLI command only, and has been moved to the command class with v13.
-
Gerrit Code Review pushed patch set 1 for main to change 87150 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2024-11-21T14:34:48+00:00" > 11/21/24, 14:34 </span> -
Gerrit Code Review pushed patch set 2 for main to change 87150 <span data-processor="relativetime" data-value="2024-11-21T14:35:06+00:00" > 11/21/24, 14:35 </span>
-
Christian Kuhn changed Related to #102258 <span data-processor="relativetime" data-value="2024-11-21T14:36:29+00:00" > 11/21/24, 14:36 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 87151 <span data-processor="relativetime" data-value="2024-11-21T14:53:34+00:00" > 11/21/24, 14:53 </span>
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 87152 <span data-processor="relativetime" data-value="2024-11-21T15:01:08+00:00" > 11/21/24, 15:01 </span>
-
Christian Kuhn commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2024-11-21T16:40:09+00:00" > 11/21/24, 16:40 </span>Applied in changeset commit:a59a0132fe6a4fd1645eb224f81703720d3959c6.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:33:27+00:00" > 12/02/25, 14:33 </span>
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