From: pear-qa at lists dot php dot net
Operating system:
PHP version: Irrelevant
PHP Bug Type: XML_XPath
Bug description: PEAR QA: improvement for get_class()-usage

## 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

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

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/XML_XPath/XPath.php' :
/cvs/php/pear/XML_XPath/XPath.php(129): // get_class returns a
lowercase name
/cvs/php/pear/XML_XPath/XPath.php(130): if ($in_type == 'object' &&
strtolower(get_class($in_xml)) == 'domdocument') {
/cvs/php/pear/XML_XPath/XPath.php(149): // get_class returns a
lowercase name
/cvs/php/pear/XML_XPath/XPath.php(150): if
(strtolower(get_class($this->xml)) == 'domdocument') {
FILE: '/cvs/php/pear/XML_XPath/XPath/common.php' :
/cvs/php/pear/XML_XPath/XPath/common.php(47): $class =
is_object($class) ? get_class($class) : $class;
/cvs/php/pear/XML_XPath/XPath/common.php(1430): if
(strtolower(get_class($this->ctx)) != 'xpathcontext') {
/cvs/php/pear/XML_XPath/XPath/common.php(1624): if
(strtolower(get_class($this->ctx)) != 'xpathcontext')

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')

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-qa @
postedFeb 26, '04 at 2:37p
activeFeb 26, '04 at 2:37p

1 user in discussion

PHP Bug Database: 1 post



site design / logo © 2022 Grokbase