From f65bb2258091e9047aaf91ca669c6152fad6d1f4 Mon Sep 17 00:00:00 2001 From: mMarinetti Date: Wed, 2 May 2012 09:07:47 +0000 Subject: [PATCH] [-] BO : no more fatal error when using Tools::apacheModExists and phpinfo() not available git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14991 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Tools.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index ccb2f7b6c..0559c8101 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2014,6 +2014,9 @@ FileETag INode MTime Size * apacheModExists return true if the apache module $name is loaded * @TODO move this method in class Information (when it will exist) * + * Notes: This method requires either apache_get_modules or phpinfo() + * to be available. + * * @param string $name module name * @return boolean true if exists * @since 1.4.5.0 @@ -2036,17 +2039,20 @@ FileETag INode MTime Size } else { - // If apache_get_modules does not exists, - // one solution should be parsing httpd.conf, - // but we could simple parse phpinfo(INFO_MODULES) return string - ob_start(); - phpinfo(INFO_MODULES); - $phpinfo = ob_get_contents(); - ob_end_clean(); - if (strpos($phpinfo, $name) !== false) - return true; + if (function_exists('phpinfo')) + { + // If apache_get_modules does not exists, + // we parse phpinfo(INFO_MODULES) return string + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_contents(); + ob_end_clean(); + if (strpos($phpinfo, $name) !== false) + return true; + } + // otherwise, use the default behavior + // see return value at the end of the function } - return false; }