Fix function stream_wrapper_restore not found

This commit is contained in:
Laurent Destailleur 2023-09-29 11:20:30 +02:00
parent 7e858125fb
commit 93bbd6770e
2 changed files with 7 additions and 3 deletions

View File

@ -56,13 +56,17 @@ class DolGeoIP
if ($type == 'country') {
// geoip may have been already included with PEAR
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
stream_wrapper_restore('phar');
if (function_exists('stream_wrapper_restore')) {
stream_wrapper_restore('phar');
}
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
}
} elseif ($type == 'city') {
// geoip may have been already included with PEAR
if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) {
stream_wrapper_restore('phar');
if (function_exists('stream_wrapper_restore')) {
stream_wrapper_restore('phar');
}
require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar';
}
} else {

View File

@ -80,7 +80,7 @@ $result = @include_once $conffile; // Keep @ because with some error reporting t
// Disable some not used PHP stream
$listofwrappers = stream_get_wrappers();
// We need '.phar' for geoip2. TODO Replace phar with explode files so we can disable phar.
// We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar.
$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftps', 'glob', 'data', 'expect', 'ftp', 'ogg', 'rar', 'zip', 'zlib');
foreach ($arrayofstreamtodisable as $streamtodisable) {
if (!empty($listofwrappers) && in_array($streamtodisable, $listofwrappers)) {