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

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


 [2004-02-26 14:51 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. Found in: \DB\DataObject.php(1719): $class = get_class($this); \DB\DataObject.php(2585): if ( get_class($obj) == 'db_dataobject') { \DB\DataObject.php(2875): if ($method == get_class($this)) { \DB\DataObject.php(2879): $class = get_class($this); \DB\DataObject.php(2901): $array = array_keys(get_class_vars($class)); \DB\DataObject.php(3114): $class = isset($this) ? get_class($this) : __CLASS__; 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-26 14:51 UTC] neufeind at php dot net
Fixed in CVS. However, a new release is due ...