LSsession :: includeFile : fix using LSlog when is not already load

Only log errors and use error_log() if LSlog is not loaded.
This commit is contained in:
Benjamin Renard 2020-05-02 18:35:19 +02:00
parent 5474cd2315
commit f8fa2e3d69

View file

@ -108,16 +108,23 @@ class LSsession {
if ($path[0] != '/') { if ($path[0] != '/') {
$found = stream_resolve_include_path($path); $found = stream_resolve_include_path($path);
if ($found === false) { if ($found === false) {
LSlog :: debug("includeFile($file, external=$external) : file $path not found in include path."); $log_msg = "includeFile($file, external=$external) : file $path not found in include path.";
if (class_exists('LSlog'))
LSlog :: warning($log_msg);
else
error_log($log_msg);
return; return;
} }
else { else {
LSlog :: debug("includeFile($file, external=$external) : file '$path' found in include path as '$found'.");
$path = $found; $path = $found;
} }
} }
else if (!file_exists($path)) { else if (!file_exists($path)) {
LSlog :: debug("includeFile($file, external=$external) : file not found ($local_path / $path)"); $log_msg = "includeFile($file, external=$external) : file not found ($local_path / $path)";
if (class_exists('LSlog'))
LSlog :: warning($log_msg);
else
error_log($log_msg);
return; return;
} }
return include_once($path); return include_once($path);