Home » Networking » Net_UserAgent_Detect » Bug #892
PEAR QA: improvement for get_class()-usage
Details
| Submitted | 2004-02-26 14:12 UTC |
|---|---|
| From | pear-qa at lists dot php dot net |
| Assigned | jrust |
| Status | Closed |
| Package | Net_UserAgent_Detect |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-02-26 14:12 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:
FILE: '/cvs/php/pear/Net_UserAgent/Detect.php' :
/cvs/php/pear/Net_UserAgent/Detect.php(206): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(454): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(478): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(519): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(548): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(566): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(588): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(611): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(633): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(672): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(702): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(725): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(747): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(769): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(791): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(813): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(841): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(878): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(911): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
/cvs/php/pear/Net_UserAgent/Detect.php(937): if (!isset($this) || get_class($this) != 'net_useragent_detect') {
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')
[2004-03-03 22:29 UTC] jrust at php dot net
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.