Project

General

Profile

Actions

Bug #106361

open

Calling Extbase Repository::findBy() with int-key array causes PHP type errors

Added by Lina Wolf 4 days ago. Updated 3 days ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2025-03-12
Due date:
% Done:

0%

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

Description

I accidently called findBy with

$user = $this->userRepository->findOneBy(['feUserId', $this->getFeUserId()]);

and the findby method was passing down the column as integer "0" all the way down to the
Typo3DbQueryParser where in line 553 there is a type error that the property name is not a string.

It took me a while of debugging why this type error was triggered. While the code I used was wrong, this
error is easy to make and a check for types should be applied earlier I feel.

The error was:

str_contains(): Argument #1 ($haystack) must be of type string, int given
in /var/www/html/vendor/typo3/cms-extbase/Classes/Persistence/Generic/Storage/Typo3DbQueryParser.php line 553


Files

extbaseFindBy.patch (810 Bytes) extbaseFindBy.patch Lina Wolf, 2025-03-12 07:33
Actions #1

Updated by Lina Wolf 4 days ago

The following patch would catch the error and provide a meaningful error message:

Actions #2

Updated by Lina Wolf 4 days ago

  • Description updated (diff)
Actions #3

Updated by Lina Wolf 4 days ago

  • Category set to Extbase
Actions #4

Updated by Gerrit Code Review 3 days 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/+/88583

Actions

Also available in: Atom PDF