Fix is_in_container not respecting open_basedir permission

If the user as added open_basedir restriction the function will fail with a Warning :
Warning: file_exists(): open_basedir restriction in effect. File(/proc/2/sched) is not within the allowed path(s)

This fix add a check that assume piwigo is not in a container when open_basedir is set
This commit is contained in:
RushLana
2025-12-08 11:26:50 +01:00
parent 8e5ecb9f7b
commit 57f725d8e6

View File

@@ -3026,7 +3026,7 @@ function pwg_unique_exec_ends($token_name)
*/ */
function is_in_container() function is_in_container()
{ {
if (strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX') if (strtoupper(substr(PHP_OS, 0, 5)) === 'LINUX' and empty(ini_get('open_basedir')))
{ {
if (file_exists('/proc/2/sched')) // Check if PID2 exist if (file_exists('/proc/2/sched')) // Check if PID2 exist
{ {
@@ -3052,4 +3052,4 @@ function is_in_container()
} }
} }
?> ?>