#111636Slug suggestion fails with a TypeError when "values" is missing
Description
Problem
The slug suggestion endpoint (/typo3/ajax/record/slug/suggest, FormSlugAjaxController::suggestAction()) answers with a 500 when the request contains no values field:
Core: Error handler (BE): PHP Warning: Undefined array key "values" in typo3/sysext/backend/Classes/Controller/FormSlugAjaxController.php line 80 Core: Exception handler (WEB): Uncaught TYPO3 Exception: TYPO3\CMS\Backend\Controller\FormSlugAjaxController::buildPreviewPath(): Argument #6 ($values) must be of type array, null given | TypeError
suggestAction() reads $queryParameters['values'] without a fallback and passes it on to buildPreviewPath(), which declares array $values.
The slug element sends such a request whenever it finds none of its source fields in the document: sendSlugProposal() collects them with document.querySelector(), and an empty values object is dropped from the request body by AjaxRequest (InputTransformer::flattenObject()).
Steps to reproduce
- Drag “Standard Page” from the page tree toolbar onto a page (or use “+ Page”). The page wizard opens at the step with title and slug.
- Type a title and press Enter, or click “Next”, right away (within the debounce time of the title listener).
- Check the System log (
sys_log) and the network tab.
Actual: the debounced slug proposal fires after the wizard has left the step, finds no title field, posts without values and gets a 500. The System log shows the warning and the TypeError above.
Expected: a request without values is handled like one with empty values and does not end in a TypeError.
Typing a title and waiting about two seconds before “Next” does not trigger it.
Possible fix
Treat missing values as empty in suggestAction():
$values = (array)($queryParameters['values'] ?? []);
Versions
Affects main and 14.3 (seen on 14.3.12, PHP 8.5). Regression of #90901 (“Show route decorations in the slug preview of pages”), which added buildPreviewPath(..., array $values). Before that change a missing values only logged the warning, and the request still succeeded.
Related: #111338 (https://review.typo3.org/c/Packages/TYPO3.CMS/+/97304, work in progress) stops the slug element’s debounced listener once the element is no longer in the document, which would also avoid the request from the wizard. The server side should still not fail on such a request.
Reviews 2
History 13
-
Markus Hofmann commented 11/27/26, 10:54
-
Gerrit Code Review pushed patch set 1 for main to change 98102 status
NewUnder Review 11/27/26, 11:24 -
Gerrit Code Review pushed patch set 1 for main to change 98104 11/27/26, 11:26
Relates: #90901 #111338