dl() is not always available in all supported PHP versions (SAPIs from 5.3+ may
authorRoland Haeder <roland@mxchange.org>
Fri, 3 Apr 2015 17:50:19 +0000 (19:50 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 3 Apr 2015 17:50:19 +0000 (19:50 +0200)
not contain it, why?). Maybe it is not contained due to security reasons?

Signed-off-by: Roland Haeder <roland@mxchange.org>
inc/filter-functions.php
inc/functions.php

index 939cd84d5b864c2fe88aa943b0adc55915b74caf..7ee7241b44a54300df887a054917f5c496520d33 100644 (file)
@@ -292,7 +292,7 @@ function runFilterChain ($filterName, $filterData = NULL) {
 
        // Is that filter chain there?
        if (!isset($GLOBALS['cache_array']['filter']['chains'][$filterName])) {
-               // Log not found filters in debug-mode
+               // Filter chain not found filters in debug-mode
                if (isDebugModeEnabled()) {
                        // Log it away...
                        logDebugMessage(__FUNCTION__, __LINE__, 'Filter chain ' . $filterName . ' does not exist.');
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