Issue Bug Closed

#94905FE requests to /index.php are broken without providing id get parameter, if no pageTypeSuffix routeEnhancer is configured

Stefan Bürk 08/16/21, 15:30 updated 10/04/22, 14:12

Description

Affected Typo3 Versions: master, 10.4.20 LTS, 9.5.30 LTS

Requests to /index.php are not working anymore, if no ?id= parameter is provided since releases today (master, 10.4.20 LTS, 9.5.30 LTS ).

This is related to the patch(es) for https://forge.typo3.org/issues/94537.

If a routeEnhancer configuration with `.php` as default is configured, it works. Without it it is broken.

routeEnhancers:
  PageTypeSuffix:
    type: PageType
    default: .php
    index: index
    map: {  }

The reason is, that replaceing of the scriptName in the url.

// TYPO3\CMS\Core\Routing\PageRouter::matchRequest()
// doing this
$urlPath = ltrim(str_replace('/' . $scriptName, '', '/' . ltrim($urlPath, '/')), '/');

// instead of 
$urlPath = str_replace('/' . $scriptName, '', $urlPath);

Would fix this and the related issue both, with and withoud a pageTypeSuffix configuration in routing. Anyway .. maybe a str_replace is to heavay, eventually it should only replace it at the starting ? Maybe doing upper as first fix and thinking about better/broader solution ?

Reviews 2