Review main Merged

90102[BUGFIX] Prevent exception on reading resource size

Oli Bartsch CR +2 V +2 Easy +3 −0 updated 07/24/25, 12:01

Commit message

Calling Stream::getSize() might result in an
exception since underlying fstat() call on
the resource might return FALSE instead of
the stats array. This is fixed by checking
the fstat() return value.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Oliver Klee +1
    • Oliver Hader +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Oliver Hader +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 89

  1. Oli Bartsch uploaded patch set 1 07/21/25, 09:06

  2. core-ci voted on patch set 1 V +1 07/21/25, 09:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82037

  3. Oliver Hader commented on patch set 1 CR +1 07/22/25, 06:42

    Looks good. How can this be reproduced?
  4. Oliver Klee voted on patch set 1 CR +1 07/22/25, 07:12

  5. Oli Bartsch commented on patch set 1 07/22/25, 07:48

    Reply

    I encountered this when calling getSize() on a claims instruction in the SudoModeRequiredEvent: ``` #[AsEventListener] public function sudoModeRequiredEvent(SudoModeRequiredEvent $event): void { $size = $event->getClaim()->instruction->getBody()->getSize(); } ```
  6. Oliver Hader commented on patch set 1 V +1 07/22/25, 08:59

    Reply

    Ack. For `php://input`, `fstat` does not work... it would be possible to use `strlen` on the contents (and to rewind the stream to the beginning). However, there also might be streams that cannot rewind (since the data is not available anymore).
  7. Benni Mack voted on patch set 1 CR +1 V +1 07/24/25, 09:38

  8. Oli Bartsch voted on patch set 1 CR +2 V +2 07/24/25, 12:01

  9. Oli Bartsch merged patch set 2 07/24/25, 12:01