#107095All occurrences of "ajax_" are removed in route keys - inconsistent Ajax keys in TYPO3.settings.ajaxUrls
Description
In the current TYPO3 core implementation, when exporting Ajax routes to the backend JavaScript (TYPO3.settings.ajaxUrls), the string “ajax_” is removed from the route key using
str_replace(‘ajax_’, ‘’, $routeIdentifier) (File: PagerRenderer.php Method addAjaxUrlsToInlineSettings Line 1533).
Problem:
This removes all occurrences of “ajax_” from the key, not just the previously added prefix. As a result, the JavaScript key does not always match the PHP registration, e.g.:
| _.Route key | _.JS key in TYPO3.settings.ajaxUrls |
|---|---|
| myext_ajax_foo_ajax_bar | myext_foo_bar |
This behavior is unintuitive.
Better Solution:
if (strncmp($routeIdentifier, ‘ajax_’, 5) === 0) {
$routeIdentifier = substr($routeIdentifier, 5);
}
Reviews 1
History 611
-
Garvin Hicking commented and changed status
NewNeeds Feedback target version Sprint Focus On Location Sprint 07/14/25, 18:43 -
Daniel Piffl commented and changed TYPO3 Version
1314 07/14/25, 19:14Garvin Hicking wrote in #note-1:
> Hey, that’s a good idea! Would you like to try to contribute this as a patch? I can help guide you through the process if you like (a first step is https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/).
>
> I think this would also classify as a bugfix for V13.I would not patch the old version. There may be implementations out there that explicitly or accidentally rely on this behavior. After a composer update, such code would then no longer work as expected.
I can provide a patch for v14.
-
Garvin Hicking commented 07/14/25, 19:29
Great, thanks a lot. With bugfixes it’s often a change in functionality, and often a trade-off. If you create the patch, the mergers can also decide whether to backport the fix (in their responsibility, not yours).
Looking forward to your patch, let me know if you have questions.
-
Gerrit Code Review pushed patch set 1 for main to change 90076 status
Needs FeedbackUnder Review 07/16/25, 07:35 -
Gerrit Code Review pushed patch set 2 for main to change 90076 07/16/25, 08:52
-
Garvin Hicking changed Duplicated by #107101 07/16/25, 13:32
-
Gerrit Code Review pushed patch set 3 for main to change 90076 07/17/25, 07:43
-
Gerrit Code Review pushed patch set 4 for main to change 90076 07/17/25, 07:49
-
Gerrit Code Review pushed patch set 5 for main to change 90076 08/11/25, 08:06
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % 08/11/25, 08:45Applied in changeset commit:b2fffc42f312c6c0367a08633323e56b59263dfe.
-
Benni Mack changed status
ResolvedClosed 08/12/25, 14:36
Hey, that’s a good idea! Would you like to try to contribute this as a patch? I can help guide you through the process if you like (a first step is https://docs.typo3.org/m/typo3/guide-contributionworkflow/main/en-us/).
I think this would also classify as a bugfix for V13.