Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fix escaped special chars in urlencoded parameters string incorrectly normalized #5771

Closed
wants to merge 1 commit into from
Closed

Fix escaped special chars in urlencoded parameters string incorrectly normalized #5771

wants to merge 1 commit into from

Conversation

Xerkus
Copy link
Member

@Xerkus Xerkus commented Jan 31, 2014

This pull request fixes #5769

@@ -1321,7 +1323,14 @@ protected static function normalizeQuery($query)
*/
protected static function normalizeFragment($fragment)
{
return static::normalizeQuery($fragment);
$fragment = self::encodeQueryFragment(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use static::encodeQueryFragment instead of self::

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But should it be static? I do not see where that can change and might require override by subclassing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't really know that. I'd argue that the entire method should be private then instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone might do special processing; so it would make sense to keep it static for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not stating which way should be used, but thought it's worth mentioning that Uri::encodeQueryFragment() is called via both static and self currently...

Uri.php:385:            $uri .= "?" . static::encodeQueryFragment($this->query);
Uri.php:389:            $uri .= "#" . static::encodeQueryFragment($this->fragment);
Uri.php:1304:           $query = self::encodeQueryFragment(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going with self here, since this is the standardized way of dealing with an URI, and there's really no need for overriding logic here.

@weierophinney weierophinney added this to the 2.2.6 milestone Mar 3, 2014
Ocramius added a commit to Ocramius/zf2 that referenced this pull request Mar 4, 2014
Ocramius added a commit to Ocramius/zf2 that referenced this pull request Mar 4, 2014
@Ocramius Ocramius closed this in 18154d8 Mar 4, 2014
@Ocramius Ocramius self-assigned this Mar 4, 2014
gianarb pushed a commit to zendframework/zend-uri that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-uri that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-uri that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zend\Uri\Uri::normalizeQuery bug: decodes special characters in query params. Affects assembled routes
6 participants