]> granicus.if.org Git - php/commitdiff
fix multiple factory calls problem with php < 4.0.7
authorTomas V.V.Cox <cox@php.net>
Thu, 9 Aug 2001 08:06:52 +0000 (08:06 +0000)
committerTomas V.V.Cox <cox@php.net>
Thu, 9 Aug 2001 08:06:52 +0000 (08:06 +0000)
pear/Mail.php

index 38f955373bc04b3f06fdc6db85b00d0e71eed707..d72f25b3d4aa0176d18685a45ad4fa29163016fd 100644 (file)
@@ -29,8 +29,8 @@ require_once 'PEAR.php';
  * @version $Revision$
  * @package Mail
  */
-class Mail extends PEAR {
-
+class Mail extends PEAR
+{
     /**
      * Provides an interface for generating Mail:: objects of various
      * types
@@ -43,13 +43,13 @@ class Mail extends PEAR {
     function factory($driver, $params = array())
     {
         $driver = strtolower($driver);
-        if (@include_once 'Mail/' . $driver . '.php') {
-            $class = 'Mail_' . $driver;
+        @include_once 'Mail/' . $driver . '.php';
+        $class = 'Mail_' . $driver;
+        if (class_exists($class)) {
             return new $class($params);
         } else {
-            return new PEAR_Error('Unable to find class for driver ' . $driver);
+            return $this->raiseError('Unable to find class for driver ' . $driver);
         }
-
     }
 
     /**