Review main Abandoned

91264[TASK] Add defensive null check in indexed search

Netresearch DTT GmbH CR 0 V -1 Normal +63 −0 updated 10/27/25, 12:51

Commit message

The preg_replace function can return null when encountering PCRE
errors such as PREG_BAD_UTF8_ERROR, PREG_BACKTRACK_LIMIT_ERROR,
or PREG_RECURSION_LIMIT_ERROR. When this null value is passed to
mb_strcut, it triggers a TypeError in PHP 8.2+.

This change adds a defensive null check that falls back to the
original content if preg_replace fails, ensuring type safety
while maintaining graceful degradation for malformed input.

Trade-off: When PCRE fails, the description will contain
un-normalized whitespace (multiple spaces/newlines preserved)
instead of being collapsed to single spaces. This is acceptable
because the alternative is a system crash preventing the document
from being indexed at all. Content discoverability is prioritized
over formatting perfection in rare edge cases.

While the original issue was resolved by fixing the content
generation in the CKEditor image extension, this defensive
approach improves overall system robustness by handling
potential PCRE failures regardless of content source.

Review

  • Code review CR 0
  • Verified V -1
    • core-ci -1 CI

Issues 1

Files 2

Review log 23

  1. Netresearch DTT GmbH uploaded patch set 1 10/27/25, 10:31

  2. core-ci voted on patch set 1 V -1 10/27/25, 10:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87632

  3. Garvin Hicking abandoned the change 10/27/25, 12:51

    (See https://review.typo3.org/c/Packages/TYPO3.CMS/+/91263 - this one is a dupe - thanks!)