From: Roland Haeder Date: Fri, 3 Apr 2015 17:50:19 +0000 (+0200) Subject: dl() is not always available in all supported PHP versions (SAPIs from 5.3+ may X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=3d9e10c043644977bec99d3926b0fe20ded0b084 dl() is not always available in all supported PHP versions (SAPIs from 5.3+ may not contain it, why?). Maybe it is not contained due to security reasons? Signed-off-by: Roland Häder --- diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 939cd84d5b..7ee7241b44 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -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.'); diff --git a/inc/functions.php b/inc/functions.php index a5a92f5ecf..86027cf9de 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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