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

Commit

Permalink
Moving excluded special characters to constant as of zendframework/ze…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Mar 4, 2014
1 parent 6628714 commit c3f70de
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ class Uri implements UriInterface
/**
* Character classes defined in RFC-3986
*/
const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
const CHAR_GEN_DELIMS = ':\/\?#\[\]@';
const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
const CHAR_RESERVED = ':\/\?#\[\]@!\$&\'\(\)\*\+,;=';
const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
const CHAR_GEN_DELIMS = ':\/\?#\[\]@';
const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
const CHAR_RESERVED = ':\/\?#\[\]@!\$&\'\(\)\*\+,;=';
/**
* Not in the spec - those characters have special meaning in urlencoded query parameters
*/
const CHAR_QUERY_DELIMS = '!\$\'\(\)\*\,';

/**
* Host part types represented as binary masks
Expand Down Expand Up @@ -1301,12 +1305,10 @@ protected static function normalizePath($path)
*/
protected static function normalizeQuery($query)
{
// those characters have special meaning in urlencoded parameters
$subDelims = str_replace(array('&', '=', '+', ';'), '', self::CHAR_SUB_DELIMS);
$query = self::encodeQueryFragment(
self::decodeUrlEncodedChars(
$query,
'/[' . self::CHAR_UNRESERVED . $subDelims . ':@\/\?]/'
'/[' . self::CHAR_UNRESERVED . self::CHAR_QUERY_DELIMS . ':@\/\?]/'
)
);

Expand Down

0 comments on commit c3f70de

Please sign in to comment.