User tests: Successful: Unsuccessful:
The new trailing slash parameter, introduced in #42702 had received another patch that changed the parameter values in the XML, see #43195. That second change was incomplete, leaving the onAfterInitialise function unpatched.
This PR fixes the issue.
See #42702 and/or code review (tbh it's a no-brainer as we are obviously comparing with a non-existing value...)
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
@brianteeman we are planing a dedicated “router test suite” sprint for that reason :) so your feedback has been heard and appreciated!
great to here I was partialy listened to. Shame that it has taken precited issues taking place AFTER the merges. Would save a lot of hurt if these untested changes had not been merged until after the tests were created. After all at least one of them was addressing a multiple year old issue
Labels |
Added:
bug
PR-5.1-dev
|
I have tested this item ✅ successfully on 81b7afe
I've tested as follows:
I've added some error logging to the code to see when which rule is attached and made sure that PHP errors are logged into a log file.
E.g. here the code with the PR applied and with my additional error logs:
if (
$app->get('sef')
&& !$app->get('sef_suffix')
&& $this->params->get('trailingslash', -1) != -1
) {
if ($this->params->get('trailingslash') == 0) {
// Remove trailingslash
$router->attachBuildRule([$this, 'removeTrailingSlash'], SiteRouter::PROCESS_AFTER);
// DEBUG
error_log('DEBUG: Rule "removeTrailingSlash" attached.');
} elseif ($this->params->get('trailingslash') == 1) {
// Add trailingslash
$router->attachBuildRule([$this, 'addTrailingSlash'], SiteRouter::PROCESS_AFTER);
// DEBUG
error_log('DEBUG: Rule "addTrailingSlash" attached.');
}
}
Then I have tested the 3 values for the "trailingslash" parameter of the SEF plugin by selecting that value, sabing the plugin settings and then calling the frontpage and watching my error log.
Without the changes from this PR, only the DEBUG: Rule "removeTrailingSlash" attached.
can be found in the PHP error log when the value of the "trailingslash" parameter is 1, i.e. "Enforce URLs with trailing slash", or when it is -1, i.e. "No change", but not when it should be, and the DEBUG: Rule "addTrailingSlash" attached.
can never be seen in the PHP error log.
With the changes from this PR applied, the debug logs appear as expected:
DEBUG: Rule "removeTrailingSlash" attached.
when the value of the "trailingslash" parameter is 0, i.e. "Enforce URLs without trailing slash"DEBUG: Rule "addTrailingSlash" attached.
when the value of the "trailingslash" parameter is 1, i.e. "Enforce URLs with trailing slash"tested this (https://raw.githubusercontent.com/joomla/joomla-cms/81b7afeda08c2dce8aec9b34267220d086e6af0b/plugins/system/sef/src/Extension/Sef.php) successfully on a live-site.
@rfmjoe Could you mark your test result in the issue tracker so it's properly counted? For doing this, go to this PR in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/43292 , use the blue "Test this" button at the top left corner, select your test result and submit. Thanks in advance.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-05-11 18:36:08 |
Closed_By | ⇒ | LadySolveig |
Thank you @SniperSister ?? and also for testing @richard67 and @rfmjoe !
Perfect example of why I said