php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25449 Small fix for PEAR::Pager_Sliding
Submitted: 2003-09-09 08:12 UTC Modified: 2003-09-09 08:23 UTC
From: info at rhalff dot com Assigned: quipo (profile)
Status: Closed Package: PEAR related
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at rhalff dot com
New email:
PHP Version: OS:

 

 [2003-09-09 08:12 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-09 08:23 UTC] quipo@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 12:01:36 2025 UTC