Home » HTML » Pager » Bug #7657
not compatible with autoload
Details
| Submitted | 2006-05-18 08:26 UTC |
|---|---|
| From | mirko at stranicata dot com |
| Assigned | quipo |
| Status | Closed |
| Package | Pager |
| PHP Version | 5.1.2 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2006-05-18 08:26 UTC] mirko at stranicata dot com
Description:
------------
If the script that uses the Pager class has some tipical use of autoloading(http://php.net/manual/en/language.oop5.autoload.php) the script will fail becuse when you make a check if the file is already included in the factory method (Pager.php line 177) you don't pass second (for autoload) argument false to
class_exists function - this means that autoload will be called and trying to load $classname...
To fix this just pass false as second arg to class_exist
Test script:
---------------
<?PHP
require_once 'Pager/Pager.php';
$params = array(
'mode' => 'Sliding',
'perPage' => 3,
'delta' => 2,
'itemData' => array('a','b','c','d','e')
);
$pager = & Pager::factory($params);
// do some stuff ...
function __autoload($class_name)
{
include_once $class_name . ".php";
}
?>
Fix:
Pager 177:
if (!class_exists($classname)) {
to become
if (!class_exists($classname), FALSE) {
Actual result:
--------------
<br />
<b>Warning</b>: include_once() [<a href='function.include'>function.include</a>]: Failed opening 'Pager_Sliding.php' for inclusion (include_path='.;C:/xampp/php/pear/;Z:/projects/libs/php/custom;Z:/projects/libs/php/smarty') in <b>D:\projects\test.php</b> on line <b>21</b><br />
bool(false)