Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
link
Commits
f4d2e2f0
Commit
f4d2e2f0
authored
Nov 17, 2013
by
John Fiala
Browse files
Issue #1616752 by Taran2L:Period in names of querystring items was being replaced with underscores.
parent
a81a4c91
Changes
2
Show whitespace changes
Inline
Side-by-side
link.module
View file @
f4d2e2f0
...
...
@@ -578,20 +578,44 @@ function _link_parse_url($url) {
// Separate out the query string, if any.
if
(
strpos
(
$url
,
'?'
)
!==
FALSE
)
{
$query
=
substr
(
$url
,
strpos
(
$url
,
'?'
)
+
1
);
parse_str
(
$query
,
$query_array
);
// See http://drupal.org/node/1710578
foreach
(
$query_array
as
$key
=>
&
$value
)
{
if
(
$value
===
''
&&
FALSE
===
strpos
(
$query
,
$key
.
'='
))
{
$value
=
NULL
;
}
}
$url_parts
[
'query'
]
=
$query_array
;
$url_parts
[
'query'
]
=
_link_parse_str
(
$query
);
$url
=
substr
(
$url
,
0
,
strpos
(
$url
,
'?'
));
}
$url_parts
[
'url'
]
=
$url
;
return
$url_parts
;
}
/**
* Bacause parse_str replaces the following characters in query parameters name
* in order to maintain compability with deprecated register_globals directive:
*
* - chr(32) ( ) (space)
* - chr(46) (.) (dot)
* - chr(91) ([) (open square bracket)
* - chr(128) - chr(159) (various)
*
* @param string $query
* Query to parse.
*
* @return Array
* Array of query parameters.
*
* @see http://php.net/manual/en/language.variables.external.php#81080
*/
function
_link_parse_str
(
$query
)
{
$query_array
=
array
();
$pairs
=
explode
(
'&'
,
$query
);
foreach
(
$pairs
as
$pair
)
{
$name_value
=
explode
(
'='
,
$pair
);
$name
=
urldecode
(
$name_value
[
0
]);
$value
=
isset
(
$name_value
[
1
])
?
urldecode
(
$name_value
[
1
])
:
NULL
;
$query_array
[
$name
]
=
$value
;
}
return
$query_array
;
}
/**
* Implements hook_theme().
*/
...
...
tests/link.crud_browser.test
View file @
f4d2e2f0
...
...
@@ -116,6 +116,12 @@ class LinkUITest extends DrupalWebTestcase {
'msg'
=>
'js url'
,
'type'
=>
self
::
LINK_INPUT_TYPE_BAD_URL
),
array
(
'href'
=>
'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-'
,
'label'
=>
'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-'
,
'msg'
=>
'Url with . in querystring'
,
'type'
=>
self
::
LINK_INPUT_TYPE_GOOD
,
),
);
$test_case
=
array
(
'href'
=>
'www.example.com/'
.
$this
->
randomName
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment