#25449 [Opn->Csd]: Small fix for PEAR::Pager_Sliding

From: Date: Tue, 09 Sep 2003 12:23:10 +0000
Subject: #25449 [Opn->Csd]: Small fix for PEAR::Pager_Sliding
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21246@lists.php.net to get a copy of this message
ID: 25449 Updated by: quipo@php.net Reported By: info at rhalff dot com -Status: Open +Status: Closed Bug Type: PEAR related Operating System: linux PHP Version: Irrelevant -Assigned To: +Assigned To: quipo New Comment: that happens because you use a different error handling, the "@" sign in front of $_GET[$this->_urlVar] was meant to suppress that warning. Anyway,thanks for your report, I'll add a check for the next release. Fixed in CVS. Previous Comments: ------------------------------------------------------------------------ [2003-09-09 08:12:25] info at rhalff dot com Description: ------------ When using strict error handling Pager_Sliding will fail because of an undefined $_GET[$this->_urlVar]) in line 882 A simple fix for this would be, to check if it is empty: if(!empty($_GET[$this->_urlVar])) { $this->_currentPage = max((int)@$_GET[$this->_urlVar], 1); } Reproduce code: --------------- <? require_once 'PEAR.php'; require_once('Pager/Sliding.php'); error_reporting(E_ALL); function php_error_handler($errno, $errstr, $errfile, $errline) { echo "<b>$errfile ($errline)</b><br>$errstr"; exit(); } set_error_handler('php_error_handler'); $params['totalItems'] = 10; $params['perPage'] = 10; $pager = &new Pager_Sliding($params); $links = $pager->getLinks(); print_r($links); ?> Expected result: ---------------- Array ( [0] => [1] => [2] => [3] => [4] => [5] => [back] => [pages] => [next] => [first] => [last] => [all] => ) Actual result: -------------- /usr/lib/php/Pager/Sliding.php (882) Undefined index: pageID ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25449&edit=1

« previous php.pear.dev (#21246) next »