From 5c07276020b7be4abd68c18dbdf4c2bf6df259ce Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 1 Feb 2010 19:07:07 +0000 Subject: - Patch #700160 by naxoc: drupal_realpath() did not always work as expected. --- includes/file.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'includes') 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; } /** -- cgit v1.2.3