Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.20
diff -u -p -r1.20 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	24 Jun 2008 21:51:02 -0000	1.20
+++ modules/simpletest/drupal_web_test_case.php	25 Jun 2008 00:24:45 -0000
@@ -819,7 +819,9 @@ class DrupalWebTestCase {
    * @param  $edit
    *   Field data in an assocative array. Changes the current input fields
    *   (where possible) to the values indicated. A checkbox can be set to
-   *   TRUE to be checked and FALSE to be unchecked.
+   *   TRUE to be checked and FALSE to be unchecked. Note that when a form
+   *   contains file upload fields, other fields cannot start with the '@'
+   *   character.
    * @param $submit
    *   Value of the submit button.
    * @param $tamper
@@ -851,10 +853,22 @@ class DrupalWebTestCase {
         // We post only if we managed to handle every field in edit and the
         // submit button matches.
         if (!$edit && $submit_matches) {
-          // cURL will handle file upload for us if asked kindly.
-          foreach ($upload as $key => $file) {
-            $post[$key] = '@' . realpath($file);
+          if ($upload) {
+            // cURL will handle file upload for us if asked kindly.
+            foreach ($upload as $key => $file) {
+              $post[$key] = '@' . realpath($file);
+            }
           }
+          else {
+            $post_array = $post;
+            $post = array();
+            foreach ($post_array as $key => $value) {
+              // Whether this needs to be urlencode or rawurlencode, is not
+              // quite clear, but this seems to be the better choice.
+              $post[] = urlencode($key) . '=' . urlencode($value);
+            }
+            $post = implode('&', $post);
+          }  
           $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post));
           // Ensure that any changes to variables in the other thread are picked up.
           $this->refreshVariables();
