diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 41a3de31f2..0217aedb54 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -846,7 +846,7 @@ function phpbb_is_writable($file) */ function phpbb_is_absolute($path) { - return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false; + return (isset($path[0]) && $path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:[/\\\]#i', $path))) ? true : false; } /** diff --git a/tests/functions/is_absolute_test.php b/tests/functions/is_absolute_test.php index 64a7a81b4a..ada4d7b4de 100644 --- a/tests/functions/is_absolute_test.php +++ b/tests/functions/is_absolute_test.php @@ -14,6 +14,7 @@ class phpbb_functions_is_absolute_test extends phpbb_test_case static public function is_absolute_data() { return array( + array('', false), array('/etc/phpbb', true), array('etc/phpbb', false),