Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.1

Bug #1377 getPageData() returns no data when $pageID is specified.
Submitted: 2004-05-10 23:29 UTC
From: ieure at php dot net Assigned: quipo
Status: Closed Package: Pager
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-10 23:29 UTC] ieure at php dot net
Description: ------------ Calling getPageData() with a specific pageID to get the data for never returns data. Examining the function, it's obvious that the data isn't generated if a pageID is specified. Additionally, there is no need for getPageData() to call itself again after the _generatePageData() call. This patch fixes both issues: diff -u -r1.11 Common.php --- Common.php 29 Apr 2004 17:27:49 -0000 1.11 +++ Common.php 10 May 2004 23:35:38 -0000 @@ -364,19 +364,16 @@ */ function getPageData($pageID = null) { - if (isset($pageID)) { - if (!empty($this->_pageData[$pageID])) { - return $this->_pageData[$pageID]; - } else { - return false; - } - } + $pageID = $pageID ? $pageID : $this->_currentPage; if (!isset($this->_pageData)) { $this->_generatePageData(); } - return $this->getPageData($this->_currentPage); + if (!empty($this->_pageData[$pageID])) { + return $this->_pageData[$pageID]; + } + return false; } // }}} Reproduce code: --------------- $pager = new Pager(); ... $data = $pager->getPageData(2); Expected result: ---------------- $data should contain data for page 2. Actual result: -------------- $data is boolean false.

Comments

 [2004-05-11 09:05 UTC] quipo
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.