Details
Description
Typically encountered with a custom plugin, a GET parameter containing 0 is left out of the array. Consider the following example:
As an example URL:
/admin/plugin/myplugin/admin_forms/fields/0/lookup/51
get[] array contains:
get[0] = lookup
get[1] = 51
However, this example URL works as expected:
/admin/plugin/myplugin/admin_forms/fields/15/lookup/1096
get[] array contains:
get[0] = 15
get[1] = 'lookup'
get[2] = 1096
Basically the value 0 does not exist in the array, but if a non-zero value is provided, it is included in GET.
Jono suggested the following fix:
vendors/minphp/bridge/lib/Router.php around line 330 change
// Only assign GET parameters that are not query parameters if (empty($part) || substr($part, 0, 1) === '?') { continue; }
To
// Only assign GET parameters that are not query parameters if ($part === '' || $part === null || substr($part, 0, 1) === '?') { continue; }
NOTE! Customer stated that this was not sufficient, and suggested the following:
Also had to do something similar near line 276 of same method:
// Begin building URI
for ($i = count($pathParts)1; $i >= 0; $i-) {
//if (!empty($pathParts[$i])) {
if ($pathParts[$i] != '' && $pathParts[$i] != null)
}
So with the edit suggested at line 330 and the edit above near line 276, the 0 is not skipped. I loaded several admin area pages and client area pages following these edits and it does not appear to have broken other pages loading.
Activity
Field | Original Value | New Value |
---|---|---|
Rank | Ranked higher |
Description |
Typically encountered with a custom plugin, a GET parameter containing 0 is left out of the array. Consider the following example:
As an example URL: /admin/plugin/myplugin/admin_forms/fields/0/lookup/51 get[] array contains: get[0] = lookup get[1] = 51 However, this example URL works as expected: /admin/plugin/myplugin/admin_forms/fields/15/lookup/1096 get[] array contains: get[0] = 15 get[1] = 'lookup' get[2] = 1096 Basically the value 0 does not exist in the array, but if a non-zero value is provided, it is included in GET. Jono suggested the following fix: vendors/minphp/bridge/lib/Router.php around line 330 change {code:java} // Only assign GET parameters that are not query parameters if (empty($part) || substr($part, 0, 1) === '?') { continue; } {code} To {code:java} // Only assign GET parameters that are not query parameters if ($part === '' || $part === null || substr($part, 0, 1) === '?') { continue; } {code} |
Typically encountered with a custom plugin, a GET parameter containing 0 is left out of the array. Consider the following example:
As an example URL: /admin/plugin/myplugin/admin_forms/fields/0/lookup/51 get[] array contains: get[0] = lookup get[1] = 51 However, this example URL works as expected: /admin/plugin/myplugin/admin_forms/fields/15/lookup/1096 get[] array contains: get[0] = 15 get[1] = 'lookup' get[2] = 1096 Basically the value 0 does not exist in the array, but if a non-zero value is provided, it is included in GET. Jono suggested the following fix: vendors/minphp/bridge/lib/Router.php around line 330 change {code:java} // Only assign GET parameters that are not query parameters if (empty($part) || substr($part, 0, 1) === '?') { continue; } {code} To {code:java} // Only assign GET parameters that are not query parameters if ($part === '' || $part === null || substr($part, 0, 1) === '?') { continue; } {code} NOTE! Customer stated that this was not sufficient, and suggested the following: Also had to do something similar near line 276 of same method: // Begin building URI for ($i = count($pathParts)-1; $i >= 0; $i--) { //if (!empty($pathParts[$i])) { if ($pathParts[$i] != '' && $pathParts[$i] != null) { $uri[] = $pathParts[$i]; } } So with the edit suggested at line 330 and the edit above near line 276, the 0 is not skipped. I loaded several admin area pages and client area pages following these edits and it does not appear to have broken other pages loading. |
Sprint | 5.11.0 Sprint 3 [ 198 ] |
Rank | Ranked higher |
Status | Open [ 1 ] | In Review [ 5 ] |
Resolution | Fixed [ 1 ] |
Status | In Review [ 5 ] | Closed [ 6 ] |