magento-lts
magento-lts copied to clipboard
Fixes `Mage_Core_Helper_Url::removeRequestParam()` for `___SID`/`SID`
Description (*)
Mage_Core_Helper_Url::removeRequestParam() uses preg_replace or str_replace that can lead to malformed urls for partial matches.
Fixed Issues (if relevant)
- Fixes OpenMage/magento-lts#4294
Manual testing scenarios (*)
$url = 'https://example.com?___SID=S&SID=S&foo=bar&boo=baz';
Mage::helper('core/url')->removeRequestParam(
$url,
Mage::getSingleton('core/session')->getSessionIdQueryParam()
);
getSessionIdQueryParam() returns SID, that should be removed.
Expected
https://example.com?___SID=S&foo=bar&boo=baz
Current
https://example.com?___foo=bar&boo=baz
@Hanmac - is this PR solving your issue? I tested and it works.
Maybe return early if the URL doesn't have '?'
Yep. Updated.