Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.204
diff -u -5 -p -r1.204 file.inc
--- includes/file.inc	30 Jan 2010 02:01:41 -0000	1.204
+++ includes/file.inc	1 Feb 2010 09:39:33 -0000
@@ -1829,13 +1829,18 @@ function drupal_realpath($uri) {
   // Otherwise, attempt PHP's realpath. This allows use of drupal_realpath even
   // for unmanaged files outside of the stream wrapper interface.
   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;
 }
 
 /**
  * Gets the name of the directory from a given path.
  *
