This is a very obscure and minor bug, but it's worth tidying up as I've just managed to trigger it.
When app.force_trailing_slash is enabled, a static page can incorrectly execute _common.php from a competing dynamic path.
Given:
page/shop/
├── @category/
│ ├── _common.php
│ └── index.php
├── static-product-page.html
└── static-product-page.php
Requesting /shop/static-product-page/ produces a logic assembly containing both page/shop/static-product-page.php AND page/shop/@category/_common.php.
The dynamic _common.php should not execute because the concrete outer page should take precedence.
The static-precedence check constructs its glob using the unmodified URI:
glob($baseDir . $uriPath . ".*")
With a trailing slash, this searches for: page/shop/static-product-page/.* instead of the correct glob page/shop/static-product-page.*.
The concequence of this is that the static route is not detected during filtering and the dynamic magic file is also incorrectly matched.
A fix can be made with a tweak to DefaultRouter::pathMatcherFilter:
$staticUriPath = rtrim($uriPath, "/");
foreach (glob($baseDir . $staticUriPath . ".*") as $globMatch) {
// existing filtering
}
This is a very obscure and minor bug, but it's worth tidying up as I've just managed to trigger it.
When
app.force_trailing_slashis enabled, a static page can incorrectly execute_common.phpfrom a competing dynamic path.Given:
Requesting
/shop/static-product-page/produces a logic assembly containing bothpage/shop/static-product-page.phpANDpage/shop/@category/_common.php.The dynamic
_common.phpshould not execute because the concrete outer page should take precedence.The static-precedence check constructs its glob using the unmodified URI:
With a trailing slash, this searches for:
page/shop/static-product-page/.*instead of the correct globpage/shop/static-product-page.*.The concequence of this is that the static route is not detected during filtering and the dynamic magic file is also incorrectly matched.
A fix can be made with a tweak to
DefaultRouter::pathMatcherFilter: