Review main Merged

83076[TASK] Harden ResourceFactory->getFileReferenceObject()

Christian Kuhn CR +2 V +2 Normal +12 −48 updated 02/22/24, 12:05

Commit message

The method throws an exception on !is_numeric() already.
This includes float, which is bogus. We can simplify
with an argument type hint.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 910

  1. Christian Kuhn uploaded patch set 1 02/22/24, 11:30

  2. core-ci voted on patch set 1 V +1 02/22/24, 11:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53445

  3. Stefan Bürk voted on patch set 1 CR +1 V +1 02/22/24, 11:43

  4. Mathias Brodala commented on patch set 1 02/22/24, 11:43

    ResourceFactory.php:427

    IMO this is a breaking (API) change since before numeric strings were also accepted. Less likely but still worth mentioning.
  5. Oliver Klee commented on patch set 1 V +1 02/22/24, 11:43

    I propose we backport this to 12.4 and 11.5 as well (as the problem can occur there as well, I'd suppose).
  6. Oliver Klee commented on patch set 1 CR +1 02/22/24, 11:44

    Reply

    Ah, scratch that. I was thinking in a nonsensical direction.
  7. Christian Kuhn commented on patch set 1 02/22/24, 11:54

    ResourceFactory.php:427 Reply

    nah. I don't think so. giving this one a float is 'obviously' wrong. the fact this did not except yet is a bug. the class is not declare strict_types=1, so php will turn a string into int if given. and phpstan already mumbles for consumers that an int must be given. i'd say it's fine to change this without further notice. what do you think?
  8. Mathias Brodala commented on patch set 1 02/22/24, 11:56

    ResourceFactory.php:427 Reply

    Good hint about the missing strict_types, didn't notice. In this case it may indeed continue to work albeit unclean/pending to fix.
  9. Christian Kuhn voted on patch set 1 CR +2 V +2 02/22/24, 12:05

  10. Christian Kuhn merged patch set 2 02/22/24, 12:05