PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » Pager » Bug #3212

rawurlencode call breaks some links in _getLinksUrl

Details

Submitted2005-01-15 17:36 UTC
Frommcallip8 at univie dot ac dot at
Assignedquipo
StatusClosed
PackagePager
PHP Version4.3.10
OSdebian testing
Roadmaps(Not assigned)

Comments

[2005-01-15 17:36 UTC] mcallip8 at univie dot ac dot at

Description:
------------
I'm not perfectly sure this is a bug, but here's what's happening:

The problem centers on the rawurlencode statements in Pager/Common.php on line 662. What happens is that GET parameters get re-encoded every time a link is
used. This can be a problem if one parameter is a '%'.

Result is as follows:

1st set of generated links:
...<a href="search_url.php?id=%25">... this is okay

2nd set of generated links:
...<a href="search_url.php?id=%2525">... this isn't

Thereby the query value turns into '%25' instead of '%'.

The same rawurlencode call seems to cause the following behaviour:
If the GET parameters contain array values of this kind: "id[]=1&id[]=2", the rawurlencode() call (to $name) changes them to "id%5B%5D=1&id%5B%5D=2"
which is okay the first time, but turns into "id%255B%255D=1&id%255B%255D=2" the second time. Amongst other problems, this causes the checks in lines
637 and 638 to fail, overwriting the id[] array with the last id value.

sample repoduce code: please try the code on your own machine, i can only supply the source

Reproduce code:
---------------
http://homepage.univie.ac.at/patrick.mcallister/test.php.txt

here's a diff against Pager/Common.php for a fix (which works for me, but has not been well tested):

http://homepage.univie.ac.at/patrick.mcallister/diffCommon.php.txt

Expected result:
----------------
$_GET should be:

array(2) {
["a"]=>
array(2) {
[0]=>
string(2) "%"
[1]=>
string(2) "%"
}
["pageID"]=>
string(1) "3"
}

Actual result:
--------------
$_GET becomes:

array(2) {
["a%5B%5D"]=> //instead of a[]
string(4) "%25"
["pageID"]=>
string(1) "4"
}