91263[BUGFIX] Handle failed preg_replace() in indexed search
Commit message
Review
-
Code review CR +2 Done
- Garvin Hicking +2
- Christian Kuhn +2
- Oli Bartsch +1
-
Verified V +2 Done
- Garvin Hicking +2
- Christian Kuhn +2
- Oli Bartsch +1
- core-ci +1 CI
Issues 1
Files 2
Review log 3648
Show 1623 earlier messages
-
Netresearch DTT GmbH uploaded patch set 1 10/27/25, 09:51
-
core-ci voted on patch set 1 V +1 10/27/25, 09:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87630
-
Netresearch DTT GmbH marked it work in progress 10/27/25, 10:04
-
Netresearch DTT GmbH uploaded patch set 2
V +110/27/25, 10:13 -
core-ci voted on patch set 2 V -1 10/27/25, 10:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87631
-
Netresearch DTT GmbH uploaded patch set 3
V -110/27/25, 10:32 -
core-ci voted on patch set 3 V -1 10/27/25, 10:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87633
-
Netresearch DTT GmbH uploaded patch set 4
V -110/27/25, 10:49 -
core-ci voted on patch set 4 V +1 10/27/25, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87635
-
Netresearch DTT GmbH marked it ready for review 10/27/25, 12:05
-
Andreas Kienast commented on patch set 4 CR -1 10/27/25, 12:13
The changes in the test don't make any sense as the sequences are properly parsed anymore. -
Netresearch DTT GmbH uploaded patch set 5 10/27/25, 12:16
Copied Votes: * Code-Review-1 (copy condition: "**changekind:NO_CHANGE** OR is:MIN") * Verified+1 (copy condition: "**changekind:NO_CHANGE**") -
Netresearch DTT GmbH uploaded patch set 6 10/27/25, 12:17
Copied Votes: * Code-Review-1 (copy condition: "**changekind:NO_CHANGE** OR is:MIN") * Verified+1 (copy condition: "**changekind:NO_CHANGE**") -
Netresearch DTT GmbH uploaded patch set 7 10/27/25, 12:17
Copied Votes: * Code-Review-1 (copy condition: "**changekind:NO_CHANGE** OR is:MIN") * Verified+1 (copy condition: "**changekind:NO_CHANGE**") -
Andreas Kienast commented on patch set 7 CR 0 10/27/25, 12:24
Reply
Hm, not sure... -
core-ci voted on patch set 5 V +1 10/27/25, 12:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87644
-
core-ci voted on patch set 6 V +1 10/27/25, 12:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87645
-
core-ci voted on patch set 7 V +1 10/27/25, 12:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87646
-
Netresearch DTT GmbH uploaded patch set 8
V +110/27/25, 12:30 -
Netresearch DTT GmbH marked it work in progress 10/27/25, 12:31
-
Netresearch DTT GmbH uploaded patch set 9 10/27/25, 12:34
-
Netresearch DTT GmbH updated the commit message in patch set 10 10/27/25, 12:37
-
Oli Bartsch commented on patch set 9 10/27/25, 12:37
Hi, thanks for your contribution! We usually push changes using our real names rather than company names or similar. Could you please adjust your name accordingly?
-
core-ci voted on patch set 8 V +1 10/27/25, 12:41 Copied votes on follow-up patch sets have been updated: * Verified+1 has been copied to patch set 9 (copy condition: "changekind:NO_CHANGE"). Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87648
-
core-ci voted on patch set 9 V +1 10/27/25, 12:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87650
-
core-ci voted on patch set 10 V +1 10/27/25, 12:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87651
-
Netresearch DTT GmbH commented on patch set 10 10/27/25, 13:10
Reply
The was useless, right, sorry, missed this. I updated the test to produce null as return value: php > $subject = "Valid start \x80\x81\x82 invalid UTF-8 sequence"; php > $result = preg_replace('/\s+/u', ' ', $subject); php > var_dump($result); // NULL NULLReply
I would love to, but gerrit did not let me log in, so i had to use the company account. Author and Committer is set to my name, dunno how to change the owner name without changing the account itself. -
Garvin Hicking commented on patch set 10 CR +1 V +1 10/27/25, 14:42
Reply
(I guess we can't easily work around that, but since the commit name and authorship are identified to you and adhere to our policy, I would argue "this is ok". IMO this shouldn't block the commit)Thanks for contributing this and working through the effort to get this here. Patch works for me! One could argue that invalid body descriptions might create other follow-up errors and maybe an error could be logged instead (and use an empty index). On the other hand, since the invalid markup is also passed through many other places (not the indexed representation, but the actual broken content) these places fail gracefully, and so then this one should to. Still curious if there could be many more follow-up issues for invalid UTF-8 markup other than indexing it. I would guess the HTMLSanitizer or other places do some heave regular expression lifting too, but seems they deal better with a NULL return. (Sidenote: We could also backport this to v13, opinions? And unsure if [BUGFIX] would apply here better, but [TASK] is fine by me)Indexer.php:864I think we could shorten this as: ``` $bodyDescription = preg_replace('/\s+/u', ' ', $indexingDataDto->body) ?? $indexingDataDto->body; ``` but the verbose approach is also fine by me. -
Netresearch DTT GmbH commented on patch set 10 10/27/25, 15:21
Reply
But this is the exact same behaviour as if `$maxL != true`. And one may argue that a php function is used which may return null, so the result should be checked for not being null before processed. -
Sebastian Mendel commented on patch set 10 10/28/25, 08:38
Reply
If it helps, you can change the ticket owner to me now. -
Garvin Hicking commented on patch set 10 10/30/25, 18:15
Reply
Cant be done easily but git commit is good, resolving (pinged oli, he's fine) -
Oli Bartsch commented on patch set 10 CR +1 V +1 10/30/25, 18:15
Reply
Acknowledged -
Christian Kuhn commented on patch set 10 CR -1 10/30/25, 18:23
IndexerTest.php:206why is system under test mocked? there is no reason to do so? -
Christian Kuhn commented on patch set 10 10/30/25, 18:25
overall, that's quite a bit fuss for this straight change. let me streamline this, i'll push an update. -
Garvin Hicking commented on patch set 10 10/30/25, 18:39
IndexerTest.php:206ReplyNo, I guess this can be reworked - probably just to make DI work? Please go ahead, much appreciated. -
Christian Kuhn commented on patch set 10 10/30/25, 18:43
IndexerTest.php:206Replyit's done due to the lengthy DI __construct dependencies. The class has functional tests already, so we'll turn the two tests into functionals. -
Christian Kuhn uploaded patch set 11
CR +1V +110/30/25, 18:53 -
Christian Kuhn commented on patch set 11 10/30/25, 18:53
IndexerTest.php:203string should use " over ' for \n to kick in. -
Christian Kuhn updated the commit message in patch set 12 10/30/25, 18:54
-
Christian Kuhn commented on patch set 12 CR +1 V +1 10/30/25, 18:55
Reply
DoneI shortened everything a bit. Hope that is fine. -
core-ci voted on patch set 11 V +1 10/30/25, 19:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88177
-
Oli Bartsch voted on patch set 12 CR +1 V +1 10/30/25, 19:05
-
core-ci voted on patch set 12 V +1 10/30/25, 19:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88179
-
Garvin Hicking commented on patch set 12 CR +1 V +1 10/30/25, 19:09
Perfect. Let's wait for @sebastian.mendel@netresearch.de to agree on the changes, than I would merge. -
Sebastian Mendel commented on patch set 12 10/31/25, 09:07
Reply
Okayish for me.I would like to mention that this is already the case if the length under a specific threshold. If i read the code correct.IndexerTest.php:167Definitely not MY style of code, wall of code hard to read, not contributor friendly. Not welcoming. Also did not find any rules in code or contribution guidelines that comments and new lines to improve readability is unwanted. Anyway, you choice. I will not block. -
Garvin Hicking commented on patch set 12 CR +2 V +2 10/31/25, 11:43
Reply
Yes, this was just to state the behaviour, because it would not be the expectation on when the "shortening" kicks in.IndexerTest.php:167ReplyI understand your feedback, but I think "shorter is better" in this case. Some things are better inferred from the code, and it reduces cognitive complexity to parse comments which can be kind of easily inferred from the code. This is often a matter of personal style, and we have no clear rules on this. Since lolli refactored this away, I'd like to allow his style in the rework - so hope you're fine that I'll resolve and merge this. -
Christian Kuhn commented on patch set 12 CR +2 V +2 10/31/25, 11:50
Reply
yeah. the entire logic is fishy. that's not topic of the fix to prevents a php error, though.IndexerTest.php:167Replyi like it a bit more dense - there is no special magic in these tiny tests. -
Garvin Hicking merged patch set 13 10/31/25, 11:53