Index: wp-includes/general-template.php
===================================================================
--- wp-includes/general-template.php	(revision 17444)
+++ wp-includes/general-template.php	(working copy)
@@ -153,8 +153,15 @@
 
 	$search_form_template = locate_template('searchform.php');
 	if ( '' != $search_form_template ) {
-		require($search_form_template);
-		return;
+		if ( !$echo ) {
+			ob_start();
+			require($search_form_template);
+			return ob_get_clean();
+		}
+		else {
+			require($search_form_template);
+			return;
+		}
 	}
 
 	$form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
