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

Bug #908 PEAR QA: improvement for get_class()-usage
Submitted: 2004-02-26 14:33 UTC
From: pear-qa at lists dot php dot net Assigned: cellog
Status: Closed Package: PEAR
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2004-02-26 14:33 UTC] pear-qa at lists dot php dot net
Description: ------------ ## from the PEAR QA team ## ## quality-assurance related ## Please note that if you don't react to this issue within 4 weeks the PEAR QA-team will take care of it automatically. This is not "rude" but necessary for QA. If this is a "false positive" and your package is not affected please apologize. This package uses get_class()-calls without care for case-sensitivity of the returned classnames. In PHP 4.x the default for getclass() was that lowercase classnames were returned. However, due to extended DOM functionality, PHP 5.x returns classnames with correct upper-and-lowercase. If you intend to run your package under both PHP4 and PHP5 please consider using case-independent comparisons or apply case-fixes. PS: Please be sure if fixes are needed to also update the checkin for all new php-snapshots! Found in: FILE: '/cvs/php-src/pear/PEAR.php' : /cvs/php-src/pear/PEAR.php(151): $classname = get_class($this); /cvs/php-src/pear/PEAR.php(186): printf("PEAR destructor called, class=%s/n", get_class($this)); /cvs/php-src/pear/PEAR.php(665): $classname = get_class($objref); /cvs/php-src/pear/PEAR.php(849): return get_class($this); /cvs/php-src/pear/PEAR.php(927): $callback = get_class($this->callback[0]) . '::' . /cvs/php-src/pear/PEAR.php(934): get_class($this), $this->message, $this->code, /cvs/php-src/pear/PEAR.php(952): get_class($this), $this->message, $this->code, ---------------------------------------- FILE: '/cvs/php-src/pear/PEAR/Autoloader.php' : /cvs/php-src/pear/PEAR/Autoloader.php(138): $methods = get_class_methods($classname); /cvs/php-src/pear/PEAR/Autoloader.php(165): if (get_class($obj) == $classname) { ---------------------------------------- FILE: '/cvs/php-src/pear/PEAR/Command.php' : /cvs/php-src/pear/PEAR/Command.php(163): strtolower($uiclass) == get_class($GLOBALS['_PEAR_Command_uiobject'])) { Reproduce code: --------------- Affected are constructs like: if (get_class($foo) == 'foo') { ... } Possible solutions for correct class-checks: strtolower(get_class($foo)) == 'foo' is_a($foo, 'foo') !strcasecmp(get_class($foo), 'foo')

Comments

 [2004-02-27 02:17 UTC] cellog
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.