PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Authentication » Auth_PrefManager » Bug #2975

is_subclass_of at line 131 warnings

Details

Submitted2004-12-16 06:12 UTC
Fromaashley at optimiser dot com
Assignedjellybob
StatusClosed
PackageAuth_PrefManager
PHP Version5.0.2
OSAny. PHP 5.0.3
Roadmaps(Not assigned)

Comments

[2004-12-16 06:12 UTC] aashley at optimiser dot com

Description:
------------
With the upgrade to PHP5.0.3 is_subclass_of generates a warning message if the class you are checking to see if the object is a subclass off has not yet been defined.

Due to the way DB works if DB::connect has not yet been called then DB_common and DB_<db specific> will not yet of been included and as such defined. So when passing in a DSN string and expecting Auth_PrefManager to make its own connection the following warning is generated:

Warning: Unknown class passed as parameter in PrefManager.php at line 131
Backtrace
/var/www/<site>/objects/Auth/PrefManager.php:myErrorHandler() at line 131 in PrefManager.php
/var/www/<site>/objects/Auth/PrefManager.php:is_subclass_of() at line 131 in PrefManager.php
/var/www/<site>/index.php:Auth_PrefManager->Auth_PrefManager() at line 146 in index.php

Note: Prefmanager is in our own file tree and not its own at this point as we require the previously submitted patch in bug #2512 for the site to work. Other than that applied patch the file is identical.

This problem is also only most annoying when using a custom error handler function. The user error function since 5.0.1 ignores all the built in limits on errors so @ doesnt work to squash it and the error_reporting ini setting has no effect on what is passed to the function.

As such to fix this problem I have reordered the checks in Auth_PrefManager::Auth_PrefManager(). First it checks if dsn is a string, then checks if its a subclass of DB_common. This will prevent the most common occurance of this problem. A warning will still however be generated if an something other than a DB_common object is passed and DB_common has not yet been loaded.

Fix is available at http://frood.cernun.net/stuff/PrefManager.php-reorder-checks.patch

[2004-12-16 06:13 UTC] aashley at optimiser dot com

gah Note should read:

Note: Prefmanager is in our own file tree and not in the usual PEAR objects tree in this site as we require the previously submitted patch in bug #2512 for the site to work. Other than that applied patch the file is identical.

[2005-10-05 10:17 UTC] u dot gioia at sinedita dot it

Got the same problem using HTML_QuickForm which in the class select.php use the function is_subclass_of

Any triks to solve the problem?