Issue Bug Closed

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

Lina Wolf 03/12/25, 07:27 updated 12/02/25, 14:22

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

  1. Lina Wolf commented and changed attached extbaseFindBy.patch 03/12/25, 07:33

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

  2. Lina Wolf changed description 03/12/25, 07:35

  3. Lina Wolf changed category 03/12/25, 10:17

  4. Gerrit Code Review pushed patch set 1 for main to change 88583 status New Under Review 03/12/25, 19:14

  5. Gerrit Code Review pushed patch set 2 for main to change 88583 03/30/25, 08:20

  6. Gerrit Code Review pushed patch set 3 for main to change 88583 03/30/25, 09:07

  7. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 03/31/25, 20:35

    Applied in changeset commit:72f938ede58c932b3f42b49d79afdca314fd3e79.

  8. Gerrit Code Review pushed patch set 1 for 13.4 to change 88853 status Resolved Under Review 03/31/25, 20:44

  9. Georg Ringer commented and changed status Under Review Resolved 03/31/25, 21:00

    Applied in changeset commit:57ff92e4ad80a060d7471eef948aab6fd1cd1f72.

  10. Benni Mack changed status Resolved Closed 12/02/25, 14:22