]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
dl() is not always available in all supported PHP versions (SAPIs from 5.3+ may
[mailer.git] / inc / functions.php
index a5a92f5ecfbdefd42ee0cd601595e16afbe1a21c..86027cf9de575646a601befcc36351e397ed1b30 100644 (file)
@@ -2913,9 +2913,16 @@ function isPhpExtensionLoaded ($extension) {
 }
 
 // Loads given library (aka. PHP extension)
-// Credits: shaunspiller at spammenot-gmail dot com ( http://de.php.net/dl#88566 )
 function loadLibrary ($n, $f = NULL) {
-       return extension_loaded($n) or dl(((PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '') . ($f ? $f : $n) . '.' . PHP_SHLIB_SUFFIX);
+       // Is the actual function dl() available? (Not on all SAPIs since 5.3)
+       if (!is_callable('dl')) {
+               // Not callable
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dl() is not callable for n=' . $n . ',f[' . gettype($f) . ']=' . $f);
+               return FALSE;
+       } // END - if
+
+       // Try to load PHP library
+       return dl(((PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '') . ($f ? $f : $n) . '.' . PHP_SHLIB_SUFFIX);
 }
 
 // "Translates" given PHP extension name into a readable version