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

Pager does not escape '&' in links

Details

Submitted2003-12-16 18:26 UTC
Fromieure at debian dot org
Assignedquipo
StatusClosed
PackagePager
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2003-12-16 18:26 UTC] ieure at debian dot org

Description:
------------
Links returned by Pager use raw '&'s in the GET string. This is broken,
and causes non-well-formed XML documents when using XHTML. '&'
should be replaced with '&'

Reproduce code:
---------------
Just examine the output of $pager->getLinks();

Expected result:
----------------
Pager should return HTML-entity-escaped link URLs.

Actual result:
--------------
Pager returns raw '&'s.

[2003-12-16 18:30 UTC] ieure at debian dot org

Hmm, tried to add a patch but it didn't seem to work. Here
are patches for Common & Jumping, against 2.0:

--- Common.php.orig Tue Dec 16 10:27:31 2003
+++ Common.php Tue Dec 16 10:28:02 2003
@@ -587,8 +587,8 @@

if ($this->_currentPage > 1) {
$back = sprintf('<a href="%s" %s
title="%s">%s</a>',
- ( $this->_append ?
$this->_url.$this->getPreviousPageID() :
-
$this->_url.sprintf($this->_fileName,
$this->getPreviousPageID()) ),
+ ( $this->_append ?
htmlentities($this->_url.$this->getPreviousPageID()) :
+
htmlentities($this->_url.sprintf($this->_fileName,
$this->getPreviousPageID())) ),
$this->_classString,
$this->_altPrev,
$this->_prevImg)
@@ -643,8 +643,8 @@
if ($this->_currentPage < $this->_totalPages) {
$next = $this->_spacesAfter
. sprintf('<a href="%s" %s
title="%s">%s</a>',
- ( $this->_append ?
$this->_url.$this->getNextPageID() :
-
$this->_url.sprintf($this->_fileName,
$this->getNextPageID()) ),
+ ( $this->_append ?
htmlentities($this->_url.$this->getNextPageID()) :
+
htmlentities($this->_url.sprintf($this->_fileName,
$this->getNextPageID())) ),
$this->_classString,
$this->_altNext,
$this->_nextImg)


--- Jumping.php.orig Tue Dec 16 10:26:00 2003
+++ Jumping.php Tue Dec 16 10:26:04 2003
@@ -254,7 +254,7 @@
if ($i != $this->_currentPage) {
$this->range[$i] = false;
$links .= sprintf('<a href="%s" %s
title="%s">%d</a>',
- ( $this->_append ?
$this->_url.$i : $this->_url.sprintf($this->_fileName, $i)
),
+ ( $this->_append ?
htmlentities($this->_url.$i) :
htmlentities($this->_url.sprintf($this->_fileName, $i)) ),
$this->_classString,
$this->_altPage.' '.$i,
$i);