PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Structures » Games_Chess » Bug #867

PEAR QA: improvement for get_class()-usage

Details

Submitted2004-02-26 13:29 UTC
Frompear-qa at lists dot php dot net
Assignedcellog
StatusClosed
PackageGames_Chess
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2004-02-26 13:29 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/Games_Chess/examples/HTMLChess.php' :
/cvs/php/pear/Games_Chess/examples/HTMLChess.php(305): if (get_class($this->_board) != 'games_chess_standard') {

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-02-26 13:30 UTC] neufeind at php dot net

Also check the test-files, please.