cvs: pear /Image_Transform Transform.php

[email protected] ("Christian Weiske")
Newsgroups php.pear.cvs
Message-ID <cvscweiske1209596541@cvsserver>
cweiske		Wed Apr 30 23:02:21 2008 UTC

  Modified files:              
    /pear/Image_Transform	Transform.php 
  Log:
  Don't try to load driver file if the class already exists
  (also useful for unit tests)
  
  
http://cvs.php.net/viewvc.cgi/pear/Image_Transform/Transform.php?r1=1.55&r2=1.56&diff_format=u
Index: pear/Image_Transform/Transform.php
diff -u pear/Image_Transform/Transform.php:1.55 pear/Image_Transform/Transform.php:1.56
--- pear/Image_Transform/Transform.php:1.55	Tue Apr 29 09:26:36 2008
+++ pear/Image_Transform/Transform.php	Wed Apr 30 23:02:21 2008
@@ -22,7 +22,7 @@
  * @author    Philippe Jausions <[email protected]>
  * @copyright 2002-2007 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version   CVS: $Id: Transform.php,v 1.55 2008/04/29 09:26:36 cweiske Exp $
+ * @version   CVS: $Id: Transform.php,v 1.56 2008/04/30 23:02:21 cweiske Exp $
  * @link      http://pear.php.net/package/Image_Transform
  */
 
@@ -238,16 +238,19 @@
                                     IMAGE_TRANSFORM_DRIVER_FILE_MISSING);
         }
 
-        include_once $file;
-
         $classname = 'Image_Transform_Driver_' . $driver;
+
         if (!class_exists($classname)) {
-            return PEAR::raiseError(
-                'Image library ' . $driver . ' not supported... aborting.',
-                IMAGE_TRANSFORM_ERROR_UNSUPPORTED
-            );
+            include_once $file;
+
+            if (!class_exists($classname)) {
+                return PEAR::raiseError(
+                    'Image library ' . $driver . ' not supported... aborting.',
+                    IMAGE_TRANSFORM_ERROR_UNSUPPORTED
+                );
+            }
         }
-        $obj =& new $classname;
+        $obj =& new $classname();
 
         // Check startup error
         if ($error =& $obj->isError()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.