fix: dont read /etc if open_basedir #4502

This commit is contained in:
Dag 2025-04-01 01:14:23 +02:00
parent db42f2786c
commit b289f1c3c4

View File

@ -175,6 +175,9 @@ function parse_mime_type($url)
'image' => 'image/*',
'mp3' => 'audio/mpeg',
];
// if-check to avoid excessive php errors about open_basedir restriction (#4502)
$open_basedir = ini_get('open_basedir');
if (! $open_basedir) {
// '@' is used to mute open_basedir warning, see issue #818
if (@is_readable('/etc/mime.types')) {
$file = fopen('/etc/mime.types', 'r');
@ -195,6 +198,7 @@ function parse_mime_type($url)
fclose($file);
}
}
}
if (strpos($url, '?') !== false) {
$url_temp = substr($url, 0, strpos($url, '?'));