Bug #911: PEAR QA: improvement for get_class()-usage
| From: | PHP Bug Database | Date: | Thu, 26 Feb 2004 15:04:19 +0000 |
| Subject: | Bug #911: PEAR QA: improvement for get_class()-usage | ||
| Groups: | php.pear.qa | ||
| Request: | Send a blank email to pear-qa+get-744@lists.php.net to get a copy of this message | ||
From: pear-qa at lists dot php dot net
Operating system:
PHP version: Irrelevant
PHP Bug Type: File_IMC
Bug description: PEAR QA: improvement for get_class()-usage
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:
\File\IMC\Build.php(541): return get_class($obj) ==
strtolower($classname) || is_subclass_of($obj, $classname);
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')
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=911&edit=2