Re: another bug (?) in DB.php
| From: | Colin Viebrock | Date: | Wed, 18 Apr 2001 23:13:02 +0000 |
| Subject: | Re: another bug (?) in DB.php | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-267@lists.php.net to get a copy of this message | ||
Sorry, I should have at least posted a possible fix ... :)
--- DB.php Wed Apr 18 19:09:30 2001
+++ new_DB.php Wed Apr 18 19:12:18 2001
@@ -185,13 +185,14 @@
@include_once("DB/${type}.php");
$classname = "DB_${type}";
- @$obj =& new $classname;
- if (!$obj) {
+ if (!class_exists($classname)) {
return PEAR::raiseError(DB_ERROR_NOT_FOUND,
null, null, null, null, 'DB_Error',
true);
}
+ @$obj =& new $classname;
+
return $obj;
}
@@ -228,17 +229,17 @@
// expose php errors with sufficient debug level
include_once "DB/${type}.php";
$classname = "DB_${type}";
- $obj =& new $classname;
} else {
@include_once "DB/${type}.php";
$classname = "DB_${type}";
- @$obj =& new $classname;
}
- if (!$obj) {
+ if (!class_exists($classname)) {
return PEAR::raiseError(DB_ERROR_NOT_FOUND,
null, null, null, null, 'DB_Error',
true);
}
+
+ @$obj =& new $classname;
if (is_array($options)) {
foreach ($options as $option => $value) {
- Colin