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 #4337

New version breaks encoding.

Details

Submitted2005-05-12 21:45 UTC
Frompager dot pear dot php dot net at matt dot thoughtprocess dot n
Assignedquipo
StatusClosed
PackagePager
PHP Version4.3.11
OSlinux
Roadmaps(Not assigned)

Comments

[2005-05-12 21:45 UTC] pager dot pear dot php dot net at matt dot thoughtprocess dot n

Description:
------------
The new version breaks a lot of my code.

Reproduce code:
---------------
This is one of the scripts in question:
http://cbp1.com/listings_search.php

If you choose '1,000,000' for a max price and 'Brentwood'

Specifically here is the original request which works with &pageID=2 appended to the end:
http://cbp1.com/listings_search.php?action=search&s%5Beq%5D%5B_prop_type%5D=RES&s%5Bbtw%5D%5B_list_price%5D%5Blow%5D=0&s%5Bbtw%5D%5B_list_price%5D%5Bhigh%5D=1000000&s%5Beq%5D%5B_square_footage%5D=%2B0&s%5Beq%5D%5B_number_of_bedrooms%5D=%2B0&s%5Beq%5D%5B_total_bathrooms%5D=%2B0&s%5Beq%5D%5B_trans%5D=S&s%5Bin%5D%5B_area%5D%5B%5D=211&s%5Bin%5D%5B_city%5D%5B%5D=0&s%5Beq%5D%5B_style%5D=0&s%5Beq%5D%5B_street_number%5D=&s%5Beq%5D%5B_street_name%5D=&s%5Beq%5D%5B_subdivision%5D=&s%5Beq%5D%5B_zip%5D=&s%5Beq%5D%5B_last_updated_date%5D=%2B0&submit=Show+Properties&pageID=2

Here is the Pager generated URL after the most recent Pager 2.3.1 that no longer works:
http://cbp1.com/listings_search.php?action=search&s[eq][_prop_type]=RES&s[eq][_square_footage]=+0&s[eq][_number_of_bedrooms]=+0&s[eq][_total_bathrooms]=+0&s[eq][_trans]=S&s[eq][_style]=0&s[eq][_street_number]=&s[eq][_street_name]=&s[eq][_subdivision]=&s[eq][_zip]=&s[eq][_last_updated_date]=+0&s[btw][_list_price][low]=0&s[btw][_list_price][high]=1000000&s[in][_area][0]=211&s[in][_city][0]=0&submit=Show%20Properties&pageID=2

Here is my external fix to take care of this problem:
// Page nav links
$links = $pager->getLinks();

foreach(array_keys($links) as $key)
{
$links[$key]=preg_replace('/\[/', "%5B", $links[$key]);
$links[$key]=preg_replace('/\]/', "%5D", $links[$key]);
$links[$key]=preg_replace('/\+/', "%2B", $links[$key]);
}

[2005-05-12 22:17 UTC] pager dot pear dot php dot net at matt dot thoughtprocess dot n

After my original submission I realized I needed two more lines to correct the first and last links in the array that have brackets around the page numbers. This is such a dirty hack. :)

// Page nav links
$links = $pager->getLinks();

foreach(array_keys($links) as $key) {
$links[$key]=preg_replace('/\[/', "%5B", $links[$key]);
$links[$key]=preg_replace('/\]/', "%5D", $links[$key]);
$links[$key]=preg_replace('/\+/', "%2B", $links[$key]);
$links[$key]=preg_replace('/\>\%5B/', ">[", $links[$key]);
$links[$key]=preg_replace('/\%5D\</', "]<", $links[$key]);
}