Project

General

Profile

Actions

Bug #105737

closed

Indexed search causes crash

Added by Guido Twieling about 2 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Indexed Search
Target version:
Start date:
2024-12-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Frontend, indexed search, links
Complexity:
Is Regression:
Sprint Focus:

Description

After inserting a link, saving and displaying it, I get the following error:

See error log.


Files

clipboard-202412011724-koo8c.png (143 KB) clipboard-202412011724-koo8c.png Guido Twieling, 2024-12-01 16:24
typo3_9d87e00b26.log (32.9 KB) typo3_9d87e00b26.log Guido Twieling, 2024-12-01 16:26
source after reopen.txt (4.53 KB) source after reopen.txt Guido Twieling, 2024-12-02 07:59
source before saveing.txt (4.78 KB) source before saveing.txt Guido Twieling, 2024-12-02 07:59
ckeditor.log (234 KB) ckeditor.log Guido Twieling, 2024-12-04 18:26
Actions #1

Updated by Guido Twieling about 2 months ago

Forgot to write: After refreshing (F5) the page is displayed. The page that was created shows a simple 5-column table with download links for files. What I also noticed is that the alt text and target _blank are deleted after repeated saving.

Actions #2

Updated by Chris Müller about 2 months ago

Looks like an error occurred in using preg_replace(), for whatever reason:
https://www.php.net/manual/en/function.preg-replace.php#refsect1-function.preg-replace-returnvalues
Then $bodyDescription is set to null.

Actions #3

Updated by Garvin Hicking about 2 months ago

  • Status changed from New to Needs Feedback

Could you please give more details where exactly you insert what. Thank you!

Updated by Guido Twieling about 2 months ago

Hello.
I just inserted a text element with a table. I attached the CKeditor source code.

Actions #5

Updated by Garvin Hicking about 1 month ago

I tried to reproduce this but could not get the error you describe.

You seem to be using special configuration or plugins because you're using `<img>` tags in the RTE which isn't possible by default. Can you please also post your CKEditor YAML configuration?

To speed up debugging maybe we can check what's going on with the failing regular expression. Could you edit your file /var/www/html/vendor/typo3/cms-indexed-search/Classes/Indexer.php and in Line 877 replace this:

            $bodyDescription = preg_replace('/\s+/u', ' ', $indexingDataDto->body);
            // Shorten the string. If the database has the wrong character set,
            // the string is probably truncated again.
            $bodyDescription = \mb_strcut($bodyDescription, 0, $maxL, 'utf-8');

to this:

            $bodyDescription = preg_replace('/\s+/u', ' ', $indexingDataDto->body);
            $fp = fopen('/var/www/html/var/typo3temp/ckeditor.log', 'a');
            fwrite($fp, "Input bodyDescription:\n" . $indexingDataDto->body . "\n----After replacement:\n" . $bodyDescription . "\n====\n");
            // Shorten the string. If the database has the wrong character set,
            // the string is probably truncated again.
            $bodyDescription = \mb_strcut($bodyDescription, 0, $maxL, 'utf-8');

Then it should create a logfile in /var/www/html/var/typo3temp/ckeditor.log which you could post after saving and the error occurs.

You could try if this helps:

            $bodyDescription = (string) preg_replace('/\s+/u', ' ', $indexingDataDto->body);

This should prevent a possible preg_replace output to be null (but would then not index anything, so that's just a workaround for the PHP error, not a real fix).

Actions #6

Updated by Guido Twieling about 1 month ago · Edited

Hello Garvin.
I have attached the ckeditor.log. I tested it a bit. The error only occurs when I link files. When I look at the log, it contains the content of the linked files.

Actions #8

Updated by Garvin Hicking about 1 month ago

  • Status changed from Needs Feedback to Closed

Thanks for the quick feedback and letting me know. I'll close this for now as suggested.

(Removal of the attributes should also be configurable through the RTE YAML Processing directives though!)

Actions

Also available in: Atom PDF