diff options
author | Daniel Hahler <git@thequod.de> | 2010-03-19 08:49:25 +0800 |
---|---|---|
committer | lillialexis <lillialexis@gmail.com> | 2010-04-29 04:38:27 +0800 |
commit | d668f7927d9c71226effe8e0bdd35587460cdb35 (patch) | |
tree | 8c2d6661b21ba7d7b5b0231f77277838658de439 | |
parent | bb0a8f0083ac40f38c9db9cc09074be9e3a8b82a (diff) | |
download | php-openid-d668f7927d9c71226effe8e0bdd35587460cdb35.zip php-openid-d668f7927d9c71226effe8e0bdd35587460cdb35.tar.gz php-openid-d668f7927d9c71226effe8e0bdd35587460cdb35.tar.bz2 |
SQLStore: use is_subclass_of to determine if we have a PEAR instance.
This prevents a blank page with no error indication at all, if there
appears to happen a fatal error when trying to require DB.php from
the global include path (very bad practice!)
Instead, using is_subclass_of should be enough, especially when
using an own implementation.
-rw-r--r-- | Auth/OpenID/SQLStore.php | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/Auth/OpenID/SQLStore.php b/Auth/OpenID/SQLStore.php index 5c75e70..c040597 100644 --- a/Auth/OpenID/SQLStore.php +++ b/Auth/OpenID/SQLStore.php @@ -14,16 +14,6 @@ */ /** - * Require the PEAR DB module because we'll need it for the SQL-based - * stores implemented here. We silence any errors from the inclusion - * because it might not be present, and a user of the SQL stores may - * supply an Auth_OpenID_DatabaseConnection instance that implements - * its own storage. - */ -global $__Auth_OpenID_PEAR_AVAILABLE; -$__Auth_OpenID_PEAR_AVAILABLE = @include_once 'DB.php'; - -/** * @access private */ require_once 'Auth/OpenID/Interface.php'; @@ -89,8 +79,6 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { $associations_table = null, $nonces_table = null) { - global $__Auth_OpenID_PEAR_AVAILABLE; - $this->associations_table_name = "oid_associations"; $this->nonces_table_name = "oid_nonces"; @@ -113,7 +101,7 @@ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { // constant, so only try to use it if PEAR is present. Note // that Auth_Openid_Databaseconnection instances need not // implement ::setFetchMode for this reason. - if ($__Auth_OpenID_PEAR_AVAILABLE) { + if (is_subclass_of($this->connection, 'db_common')) { $this->connection->setFetchMode(DB_FETCHMODE_ASSOC); } |