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

Bug #889 PEAR QA: improvement for get_class()-usage
Submitted: 2004-02-26 14:08 UTC
From: darkelder Assigned: ekilfoil
Status: Closed Package: Net_IPv4
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2004-02-26 14:08 UTC] darkelder
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: '/cvs/php/pear/Net_IPv4/IPv4.php' : /cvs/php/pear/Net_IPv4/IPv4.php(326): if (! is_object($network) || get_class($network) != 'net_ipv4') { /cvs/php/pear/Net_IPv4/IPv4.php(329): if (! is_object($network) || get_class($network) != 'net_ipv4') { 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-04-28 02:54 UTC] eric at ypass dot net
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/packages.php
 [2005-07-29 19:16 UTC] darkelder
Bug is not fixed on ipInNetwork() function (http://cvs.php.net/co.php/pear/Net_IPv4/IPv4.php?r=1.6#372)
 [2005-08-11 14:00 UTC] lazarov at mail dot bg
Hmz, this bug is realy not fixed cleanly. Please fix it in function ipInNetwork(), file IPv4.php, line 372.
 [2005-11-22 11:23 UTC] bate
I replaced all checks with strcasecmp() calls.