We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 0ec07e9c authored by Brion Vibber's avatar Brion Vibber

Use ReflectionFunction to check for a present-but-disabled dl() function...

Use ReflectionFunction to check for a present-but-disabled dl() function instead of manually parsing the disable_functions php.ini setting.

We were checking the list as comma-delimited (per the description of it as comma-delimited), but in fact spaces are also accepted, and who knows what else.
parent d0d39b51
......@@ -60,8 +60,13 @@ if (!function_exists('dl')) {
// Fortunately trying to call the disabled one will only trigger
// a warning, not a fatal, so it's safe to leave it for our case.
// Callers will be suppressing warnings anyway.
$disabled = array_filter(array_map('trim', explode(',', ini_get('disable_functions'))));
if (!in_array('dl', $disabled)) {
try {
// Reading the ini setting is hard as we don't know PHP's parsing,
// but we can check if it is disabled through reflection.
$dl = new ReflectionFunction('dl');
// $disabled = $dl->isDisabled(); // don't need to check this now
} catch (ReflectionException $e) {
// Ok, it *really* doesn't exist!
function dl($library) {
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment