#106361Calling Extbase Repository::findBy() with int-key array causes PHP type errors
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
Reviews 2
Files 1
History 610
-
Lina Wolf commented and changed attached extbaseFindBy.patch 03/12/25, 07:33
-
Lina Wolf changed description 03/12/25, 07:35
-
Lina Wolf changed category 03/12/25, 10:17
-
Gerrit Code Review pushed patch set 1 for main to change 88583 status
NewUnder Review 03/12/25, 19:14 -
Gerrit Code Review pushed patch set 2 for main to change 88583 03/30/25, 08:20
-
Gerrit Code Review pushed patch set 3 for main to change 88583 03/30/25, 09:07
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % 03/31/25, 20:35Applied in changeset commit:72f938ede58c932b3f42b49d79afdca314fd3e79.
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88853 status
ResolvedUnder Review 03/31/25, 20:44 -
Georg Ringer commented and changed status
Under ReviewResolved 03/31/25, 21:00Applied in changeset commit:57ff92e4ad80a060d7471eef948aab6fd1cd1f72.
-
Benni Mack changed status
ResolvedClosed 12/02/25, 14:22
The following patch would catch the error and provide a meaningful error message: