svn: /pear/pear-core/trunk/ PEAR.php

[email protected] (Helgi Þormar Þorbjörnsson)
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
dufuz                                    Sat, 08 May 2010 19:42:27 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299151

Log:
clean up the code block for loadExtension()

Changed paths:
    U   pear/pear-core/trunk/PEAR.php

Modified: pear/pear-core/trunk/PEAR.php
===================================================================
--- pear/pear-core/trunk/PEAR.php	2010-05-08 19:32:23 UTC (rev 299150)
+++ pear/pear-core/trunk/PEAR.php	2010-05-08 19:42:27 UTC (rev 299151)
@@ -735,32 +735,32 @@
     */
     function loadExtension($ext)
     {
-        if (!extension_loaded($ext)) {
-            // if either returns true dl() will produce a FATAL error, stop that
-            if (
-                function_exists('dl') === false ||
-                ini_get('enable_dl') != 1 ||
-                ini_get('safe_mode') == 1
-            ) {
-                return false;
-            }
+        if (extension_loaded($ext)) {
+            return true;
+        }

-            if (OS_WINDOWS) {
-                $suffix = '.dll';
-            } elseif (PHP_OS == 'HP-UX') {
-                $suffix = '.sl';
-            } elseif (PHP_OS == 'AIX') {
-                $suffix = '.a';
-            } elseif (PHP_OS == 'OSX') {
-                $suffix = '.bundle';
-            } else {
-                $suffix = '.so';
-            }
+        // if either returns true dl() will produce a FATAL error, stop that
+        if (
+            function_exists('dl') === false ||
+            ini_get('enable_dl') != 1 ||
+            ini_get('safe_mode') == 1
+        ) {
+            return false;
+        }

-            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
+        if (OS_WINDOWS) {
+            $suffix = '.dll';
+        } elseif (PHP_OS == 'HP-UX') {
+            $suffix = '.sl';
+        } elseif (PHP_OS == 'AIX') {
+            $suffix = '.a';
+        } elseif (PHP_OS == 'OSX') {
+            $suffix = '.bundle';
+        } else {
+            $suffix = '.so';
         }

-        return true;
+        return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
     }

     // }}}
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.