From: Tomas V.V.Cox Date: Thu, 9 Aug 2001 08:06:52 +0000 (+0000) Subject: fix multiple factory calls problem with php < 4.0.7 X-Git-Tag: BEFORE_EXP_MERGE~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4cdd3af848e79a7577d32ac688b981fc5fc8e89;p=php fix multiple factory calls problem with php < 4.0.7 --- diff --git a/pear/Mail.php b/pear/Mail.php index 38f955373b..d72f25b3d4 100644 --- a/pear/Mail.php +++ b/pear/Mail.php @@ -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); } - } /**