Issue Bug Closed

#105537Strict Typing causes TypeError in SlugService of redirects module

Jörn Wagner 11/04/24, 14:18 updated 11/28/24, 15:54

Description

In certain circumstances, an editor can be confronted with a 503 error in the backend after editing a page record.

The log then shows the following error message:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: strpos(): Argument #1 ($haystack) must be of type string, null given | 
TypeError thrown in file /var/www/public/typo3/sysext/redirects/Classes/Service/SlugService.php in line 282.

Preconditions for this bug to occur:

1. autoUpdateSlugs must be set to true (default)
2. Strict Typing must have been activated through a hook listening to processDatamap_afterDatabaseOperations for table pages
3. Page must have a sub-page with an empty slug¹
4. Parent page record is edited with a change in either the slug or the title that will result in an update to the slugs of the sub pages

¹ I don’t even know how we got to this point as I’ve been unable to get any page to be saved with an empty slug, but I guess the data schema allows it so we have to provision against it

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.