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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!