diff options
-rw-r--r-- | includes/file.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/file.inc b/includes/file.inc index b03e9d4d9..1b06895af 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -1831,9 +1831,14 @@ function drupal_realpath($uri) { if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) { return $wrapper->realpath(); } - else { + // Check that the uri has a value. There is a bug in PHP 5.2 on *BSD systems + // that makes realpath not return FALSE as expected when passing an empty + // variable. + // @todo Remove when Drupal drops support for PHP 5.2. + elseif (!empty($uri)) { return realpath($uri); } + return FALSE; } /** |