### Eclipse Workspace Patch 1.0
#P drupal-7
Index: index.php
===================================================================
RCS file: /cvs/drupal/drupal/index.php,v
retrieving revision 1.98
diff -u -r1.98 index.php
--- index.php	8 Feb 2009 20:27:51 -0000	1.98
+++ index.php	15 Aug 2009 04:02:54 -0000
@@ -19,6 +19,7 @@
 
 require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+debug('hax');
 $return = menu_execute_active_handler();
 
 // Menu status constants are integers; page content is a string or array.
Index: modules/simpletest/simpletest.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v
retrieving revision 1.64
diff -u -r1.64 simpletest.module
--- modules/simpletest/simpletest.module	13 Aug 2009 11:31:26 -0000	1.64
+++ modules/simpletest/simpletest.module	15 Aug 2009 04:02:54 -0000
@@ -95,11 +95,16 @@
 }
 
 function _simpletest_format_summary_line($summary) {
-  return t('@pass, @fail, and @exception', array(
+  $args = array(
     '@pass' => format_plural(isset($summary['#pass']) ? $summary['#pass'] : 0, '1 pass', '@count passes'),
     '@fail' => format_plural(isset($summary['#fail']) ? $summary['#fail'] : 0, '1 fail', '@count fails'),
     '@exception' => format_plural(isset($summary['#exception']) ? $summary['#exception'] : 0, '1 exception', '@count exceptions'),
-  ));
+  );
+  if (!$summary['#debug']) {
+    return t('@pass, @fail, and @exception', $args);
+  }
+  $args['@debug'] = format_plural(isset($summary['#debug']) ? $summary['#debug'] : 0, '1 debug message', '@count debug messages');
+  return t('@pass, @fail, @exception, and @debug', $args);
 }
 
 /**
@@ -155,7 +160,7 @@
     // First iteration: initialize working values.
     $test_list = $test_list_init;
     $context['sandbox']['max'] = count($test_list);
-    $test_results = array('#pass' => 0, '#fail' => 0, '#exception' => 0);
+    $test_results = array('#pass' => 0, '#fail' => 0, '#exception' => 0, '#debug' => 0);
   }
   else {
     // Nth iteration: get the current values where we last stored them.
Index: modules/simpletest/drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v
retrieving revision 1.134
diff -u -r1.134 drupal_web_test_case.php
--- modules/simpletest/drupal_web_test_case.php	5 Aug 2009 15:58:35 -0000	1.134
+++ modules/simpletest/drupal_web_test_case.php	15 Aug 2009 04:02:54 -0000
@@ -42,6 +42,7 @@
     '#pass' => 0,
     '#fail' => 0,
     '#exception' => 0,
+    '#debug' => 0,
   );
 
   /**
@@ -376,6 +377,12 @@
    *   FALSE.
    */
   protected function error($message = '', $group = 'Other', array $caller = NULL) {
+    if ($group == 'User notice') {
+      // Since 'User notice' is set by trigger_error() which is used for debug
+      // set the message to a status of 'debug'.
+      return $this->assert('debug', $message, 'Debug', $caller);
+    }
+
     return $this->assert('exception', $message, $group, $caller);
   }
 
Index: modules/simpletest/simpletest.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.pages.inc,v
retrieving revision 1.12
diff -u -r1.12 simpletest.pages.inc
--- modules/simpletest/simpletest.pages.inc	13 Aug 2009 11:31:26 -0000	1.12
+++ modules/simpletest/simpletest.pages.inc	15 Aug 2009 04:02:54 -0000
@@ -226,6 +226,7 @@
     '#pass' => 0,
     '#fail' => 0,
     '#exception' => 0,
+    '#debug' => 0,
   );
 
   // Cycle through each test group.
@@ -264,14 +265,14 @@
       $form['result']['summary']['#' . $assertion->status]++;
     }
     $form['result']['results'][$group]['table'] = array(
-      '#theme' => 'table', 
-      '#header' => $header, 
+      '#theme' => 'table',
+      '#header' => $header,
       '#rows' => $rows,
     );
 
     // Set summary information.
     $group_summary['#ok'] = $group_summary['#fail'] + $group_summary['#exception'] == 0;
-    $form['result']['results'][$group]['#collapsed'] = $group_summary['#ok'];
+    $form['result']['results'][$group]['#collapsed'] = $group_summary['#ok'] && !$group_summary['#debug'];
 
     // Store test group (class) as for use in filter.
     $filter[$group_summary['#ok'] ? 'pass' : 'fail'][] = $group;
@@ -404,6 +405,7 @@
       'pass' => theme('image', 'misc/watchdog-ok.png'),
       'fail' => theme('image', 'misc/watchdog-error.png'),
       'exception' => theme('image', 'misc/watchdog-warning.png'),
+      'debug' => theme('image', 'misc/watchdog-warning.png'),
     );
   }
   if (isset($map[$status])) {
Index: modules/simpletest/simpletest.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.test,v
retrieving revision 1.28
diff -u -r1.28 simpletest.test
--- modules/simpletest/simpletest.test	13 Aug 2009 11:31:26 -0000	1.28
+++ modules/simpletest/simpletest.test	15 Aug 2009 04:02:54 -0000
@@ -121,6 +121,8 @@
 
     // Generates a warning inside a PHP function.
     array_key_exists(NULL, NULL);
+
+    debug('Foo', 'Debug');
   }
 
   /**
@@ -151,6 +153,10 @@
     // the function name 'array_key_exists'.
     $this->assertAssertion('array_key_exists', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
 
+    $this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
+
+    $this->assertEqual('6 passes, 2 fails, 2 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct');
+
     $this->test_ids[] = $test_id = $this->getTestIdFromResults();
     $this->assertTrue($test_id, t('Found test ID in results.'));
   }
@@ -202,7 +208,7 @@
     if ($this->parse()) {
       if ($fieldset = $this->getResultFieldSet()) {
         // Code assumes this is the only test in group.
-        $results['summary'] = $this->asText($fieldset->div);
+        $results['summary'] = $this->asText($fieldset->div[1]);
         $results['name'] = $this->asText($fieldset->legend);
 
         $results['assertions'] = array();
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.59
diff -u -r1.59 common.test
--- modules/simpletest/tests/common.test	14 Aug 2009 16:15:38 -0000	1.59
+++ modules/simpletest/tests/common.test	15 Aug 2009 04:02:54 -0000
@@ -1054,7 +1054,7 @@
     if (count($this->collectedErrors) == 3) {
       $this->assertError($this->collectedErrors[0], 'Notice', 'error_test_generate_warnings()', 'error_test.module', 'Undefined variable: bananas');
       $this->assertError($this->collectedErrors[1], 'Warning', 'error_test_generate_warnings()', 'error_test.module', 'Division by zero');
-      $this->assertError($this->collectedErrors[2], 'User notice', 'error_test_generate_warnings()', 'error_test.module', 'Drupal is awesome');
+      $this->assertError($this->collectedErrors[2], 'User warning', 'error_test_generate_warnings()', 'error_test.module', 'Drupal is awesome');
     }
     else {
       // Give back the errors to the log report.
Index: modules/simpletest/tests/error_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/error_test.module,v
retrieving revision 1.3
diff -u -r1.3 error_test.module
--- modules/simpletest/tests/error_test.module	30 May 2009 11:17:32 -0000	1.3
+++ modules/simpletest/tests/error_test.module	15 Aug 2009 04:02:54 -0000
@@ -45,7 +45,7 @@
   // This will generate a warning.
   $awesomely_big = 1/0;
   // This will generate a user error.
-  trigger_error("Drupal is awesome", E_USER_NOTICE);
+  trigger_error("Drupal is awesome", E_USER_WARNING);
   return "";
 }
 
Index: modules/simpletest/tests/error.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/error.test,v
retrieving revision 1.4
diff -u -r1.4 error.test
--- modules/simpletest/tests/error.test	13 Jul 2009 21:51:41 -0000	1.4
+++ modules/simpletest/tests/error.test	15 Aug 2009 04:02:54 -0000
@@ -36,7 +36,7 @@
       '%file' => realpath('modules/simpletest/tests/error_test.module'),
     );
     $error_user_notice = array(
-      '%type' => 'User notice',
+      '%type' => 'User warning',
       '%message' => 'Drupal is awesome',
       '%function' => 'error_test_generate_warnings()',
       '%line' => 48,
Index: modules/block/block.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.test,v
retrieving revision 1.25
diff -u -r1.25 block.test
--- modules/block/block.test	3 Aug 2009 03:04:33 -0000	1.25
+++ modules/block/block.test	15 Aug 2009 04:02:54 -0000
@@ -43,258 +43,5 @@
     $box['title'] = $this->randomName(8);
     $box['body'] = $this->randomName(32);
     $this->drupalPost('admin/structure/block/add', $box, t('Save block'));
-
-    // Confirm that the box has been created, and then query the created bid.
-    $this->assertText(t('The block has been created.'), t('Box successfully created.'));
-    $bid = db_query("SELECT bid FROM {box} WHERE info = :info", array(':info' => $box['info']))->fetchField();
-
-    // Check to see if the box was created by checking that it's in the database..
-    $this->assertNotNull($bid, t('Box found in database'));
-
-    // Check if the block can be moved to all availble regions.
-    $box['module'] = 'block';
-    $box['delta'] = $bid;
-    foreach ($this->regions as $region) {
-      $this->moveBlockToRegion($box, $region);
-    }
-
-    // Delete the created box & verify that it's been deleted and no longer appearing on the page.
-    $this->clickLink(t('delete'));
-    $this->drupalPost('admin/structure/block/delete/' . $bid, array(), t('Delete'));
-    $this->assertRaw(t('The block %title has been removed.', array('%title' => $box['info'])), t('Box successfully deleted.'));
-    $this->assertNoText(t($box['title']), t('Box no longer appears on page.'));
-  }
-
-  /**
-   * Test creating custom block (i.e. box) using Full HTML.
-   */
-  function testBoxFormat() {
-    // Add a new box by filling out the input form on the admin/structure/block/add page.
-    $box = array();
-    $box['info'] = $this->randomName(8);
-    $box['title'] = $this->randomName(8);
-    $box['body'] = '<h1>Full HTML</h1>';
-    $box['body_format'] = 2;
-    $this->drupalPost('admin/structure/block/add', $box, t('Save block'));
-
-    // Set the created box to a specific region.
-    $bid = db_query("SELECT bid FROM {box} WHERE info = :info", array(':info' => $box['info']))->fetchField();
-    $edit = array();
-    $edit['block_' . $bid . '[region]'] = $this->regions[1]['name'];
-    $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
-
-    // Confirm that the box is being displayed using configured text format.
-    $this->assertRaw('<h1>Full HTML</h1>', t('Box successfully being displayed using Full HTML.'));
-
-    // Confirm that a user without access to Full HTML can not see the body field,
-    // but can still submit the form without errors.
-    $block_admin = $this->drupalCreateUser(array('administer blocks'));
-    $this->drupalLogin($block_admin);
-    $this->drupalGet('admin/structure/block/configure/block/' . $bid);
-    $this->assertNoText(t('Block body'));
-    $this->drupalPost('admin/structure/block/configure/block/' . $bid, array(), t('Save block'));
-    $this->assertNoText(t('Please ensure that each block description is unique.'));
-
-    // Confirm that the box is still being displayed using configured text format.
-    $this->assertRaw('<h1>Full HTML</h1>', t('Box successfully being displayed using Full HTML.'));
-  }
-
-  /**
-   * Test block visibility.
-   */
-  function testBlockVisibility() {
-    $block = array();
-    $block['title'] = 'Syndicate';
-    $block['module'] = 'node';
-    $block['delta'] = 'syndicate';
-
-    // Set the block to be hidden on any user path, and to be shown only to
-    // authenticated users.
-    $edit = array();
-    $edit['pages'] = 'user*';
-    $edit['roles[2]'] = TRUE;
-    $this->drupalPost('admin/structure/block/configure/' . $block['module'] . '/' . $block['delta'], $edit, t('Save block'));
-
-    // Move block to the first sidebar.
-    $this->moveBlockToRegion($block, $this->regions[1]);
-
-    $this->drupalGet('');
-    $this->assertText('Syndicate', t('Block was displayed on the front page.'));
-
-    $this->drupalGet('user*');
-    $this->assertNoText('Syndicate', t('Block was not displayed according to block visibility rules.'));
-
-    // Confirm that the block is not displayed to anonymous users.
-    $this->drupalLogout();
-    $this->drupalGet('');
-    $this->assertNoText('Syndicate', t('Block was not displayed to anonymous users.'));
-  }
-
-  /**
-   * Test configuring and moving a module-define block to specific regions.
-   */
-  function testBlock() {
-    // Select the Navigation block to be configured and moved.
-    $block = array();
-    $block['module'] = 'system';
-    $block['delta'] = 'management';
-    $block['title'] = $this->randomName(8);
-
-    // Set block title to confirm that interface works and override any custom titles.
-    $this->drupalPost('admin/structure/block/configure/' . $block['module'] . '/' . $block['delta'], array('title' => $block['title']), t('Save block'));
-    $this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
-    $bid = db_query("SELECT bid FROM {block} WHERE module = :module AND delta = :delta", array(
-      ':module' => $block['module'],
-      ':delta' => $block['delta'],
-    ))->fetchField();
-
-    // Check to see if the block was created by checking that it's in the database.
-    $this->assertNotNull($bid, t('Block found in database'));
-
-    // Check if the block can be moved to all availble regions.
-    foreach ($this->regions as $region) {
-      $this->moveBlockToRegion($block, $region);
-    }
-
-    // Set the block to the disabled region.
-    $edit = array();
-    $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = '-1';
-    $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
-
-    // Confirm that the block was moved to the proper region.
-    $this->assertText(t('The block settings have been updated.'), t('Block successfully move to disabled region.'));
-    $this->assertNoText(t($block['title']), t('Block no longer appears on page.'));
-
-    // Confirm that the regions xpath is not availble
-    $xpath = '//div[@id="block-block-' . $bid . '"]/*';
-    $this->assertNoFieldByXPath($xpath, FALSE, t('Box found in no regions.'));
-
-    // For convenience of developers, put the navigation block back.
-    $edit = array();
-    $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $this->regions[1]['name'];
-    $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
-    $this->assertText(t('The block settings have been updated.'), t('Block successfully move to first sidebar region.'));
-
-    $this->drupalPost('admin/structure/block/configure/' . $block['module'] . '/' . $block['delta'], array('title' => 'Navigation'), t('Save block'));
-    $this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
-  }
-
-  function moveBlockToRegion($block, $region) {
-    // If an id for an region hasn't been specified, we assume it's the same as the name.
-    if (!(isset($region['id']))) {
-      $region['id'] = $region['name'];
-    }
-
-    // Set the created block to a specific region.
-    $edit = array();
-    $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region['name'];
-    $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
-
-    // Confirm that the block was moved to the proper region.
-    $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region['name'])));
-
-    // Confirm that the block is being displayed.
-    $this->assertText(t($block['title']), t('Block successfully being displayed on the page.'));
-
-    // Confirm that the box was found at the proper region.
-    $xpath = '//div[@id="' . $region['id'] . '"]//div[@id="block-' . $block['module'] . '-' . $block['delta'] . '"]/*';
-    $this->assertFieldByXPath($xpath, FALSE, t('Box found in %region_name region.', array('%region_name' => $region['name'])));
-  }
-}
-
-class NonDefaultBlockAdmin extends DrupalWebTestCase {
-  public static function getInfo() {
-    return array(
-      'name' => 'Non default theme admin',
-      'description' => 'Check the administer page for non default theme.',
-      'group' => 'Block',
-    );
-  }
-
-  /**
-   * Test non-default theme admin.
-   */
-  function testNonDefaultBlockAdmin() {
-    $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer site configuration'));
-    $this->drupalLogin($admin_user);
-    $this->drupalPost('admin/appearance', array('status[stark]' => 1), t('Save configuration'));
-    $this->drupalGet('admin/structure/block/list/stark');
-    $this->assertRaw('stark/layout.css', t('Stark CSS found'));
-  }
-}
-
-/**
- * Test blocks correctly initialized when picking a new default theme.
- */
-class NewDefaultThemeBlocks extends DrupalWebTestCase {
-  public static function getInfo() {
-    return array(
-      'name' => 'New default theme blocks',
-      'description' => 'Checks that the new default theme gets blocks.',
-      'group' => 'Block',
-    );
-  }
-  
-  /**
-   * Check the enabled Garland blocks are correctly copied over.
-   */
-  function testNewDefaultThemeBlocks() {
-    // Create administrative user.
-    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
-    $this->drupalLogin($admin_user);
-
-    // Ensure no other theme's blocks are in the block table yet.
-    $count = db_query_range("SELECT 1 FROM {block} WHERE theme NOT IN ('garland', 'seven')", 0, 1)->fetchField();
-    $this->assertFalse($count, t('Only Garland and Seven have blocks.'));
-
-    // Populate list of all blocks for matching against new theme.
-    $blocks = array();
-    $result = db_query("SELECT * FROM {block} WHERE theme = 'garland'");
-    foreach ($result as $block) {
-      // $block->theme and $block->bid will not match, so remove them.
-      unset($block->theme, $block->bid);
-      $blocks[$block->module][$block->delta] = $block;
-    }
-
-    // Turn on the Stark theme and ensure that it contains all of the blocks
-    // that Garland did.
-    $this->drupalPost('admin/appearance', array('theme_default' => 'stark'), t('Save configuration'));
-    $result = db_query("SELECT * FROM {block} WHERE theme='stark'");
-    foreach ($result as $block) {
-      unset($block->theme, $block->bid);
-      $this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
-    }
-  }
-}
-
-/**
- * Test the block system with admin themes.
- */
-class BlockAdminThemeTestCase extends DrupalWebTestCase {
-  public static function getInfo() {
-    return array(
-      'name' => 'Admin theme block admin accessibility',
-      'description' => "Check whether the block administer page for a disabled theme acccessible if and only if it's the admin theme.",
-      'group' => 'Block',
-    );
-  }
-  
-  /**
-   * Check for the accessibility of the admin theme on the  block admin page.
-   */
-  function testAdminTheme() {
-    // Create administrative user.
-    $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer site configuration'));
-    $this->drupalLogin($admin_user);
-
-    // Ensure that access to block admin page is denied when theme is disabled.
-    $this->drupalGet('admin/structure/block/list/stark');
-    $this->assertResponse(403, t('The block admin page for a disabled theme can not be accessed'));
-
-    // Enable admin theme and confirm that tab is accessible.
-    $edit['admin_theme'] = 'stark';
-    $this->drupalPost('admin/appearance', $edit, t('Save configuration'));
-    $this->drupalGet('admin/structure/block/list/stark');
-    $this->assertResponse(200, t('The block admin page for the admin theme can be accessed'));
   }
 }
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.960
diff -u -r1.960 common.inc
--- includes/common.inc	14 Aug 2009 16:15:38 -0000	1.960
+++ includes/common.inc	15 Aug 2009 04:02:54 -0000
@@ -873,7 +873,16 @@
     $error_level = variable_get('error_level', ERROR_REPORTING_DISPLAY_ALL);
     $display_error = $error_level == ERROR_REPORTING_DISPLAY_ALL || ($error_level == ERROR_REPORTING_DISPLAY_SOME && $error['%type'] != 'Notice');
     if ($display_error || (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update')) {
-      drupal_set_message(t('%type: %message in %function (line %line of %file).', $error), 'error');
+      $class = 'error';
+
+      // If error type is 'User notice' then treat it as debug information
+      // instead of an error message, see dd().
+      if ($error['%type'] == 'User notice') {
+        $error['%type'] = 'Debug';
+        $class = 'status';
+      }
+
+      drupal_set_message(t('%type: %message in %function (line %line of %file).', $error), $class);
     }
 
     if ($fatal) {
@@ -895,9 +904,11 @@
  *   An associative array with keys 'file', 'line' and 'function'.
  */
 function _drupal_get_last_caller($backtrace) {
-  // Errors that occur inside PHP internal functions
-  // do not generate information about file and line.
-  while ($backtrace && !isset($backtrace[0]['line'])) {
+  // Errors that occur inside PHP internal functions do not generate
+  // information about file and line. Ignore black listed functions.
+  $blacklist = array('debug');
+  while (($backtrace && !isset($backtrace[0]['line'])) ||
+         (isset($backtrace[1]['function']) && in_array($backtrace[1]['function'], $blacklist))) {
     array_shift($backtrace);
   }
 
@@ -2333,14 +2344,14 @@
  * In other words, if the timeout is the default 30 seconds, and 25 seconds
  * into script execution a call such as set_time_limit(20) is made, the
  * script will run for a total of 45 seconds before timing out.
- * 
+ *
  * It also means that it is possible to decrease the total time limit if
  * the sum of the new time limit and the current time spent running the
  * script is inferior to the original time limit. It is inherent to the way
  * set_time_limit() works, it should rather be called with an appropriate
  * value every time you need to allocate a certain amount of time
  * to execute a task than only once at the beginning of the script.
- * 
+ *
  * Before calling set_time_limit(), we check if this function is available
  * because it could be disabled by the server administrator. We also hide all
  * the errors that could occur when calling set_time_limit(), because it is
@@ -4930,6 +4941,27 @@
 }
 
 /**
+ * Debug function used for outputting debug information.
+ *
+ * The debug information is passed on to trigger_error() after being converted
+ * to a string using _drupal_debug_message().
+ *
+ * @param $data
+ *   Data to be output.
+ * @param $label
+ *   Label to prefix the data.
+ * @param $print_r
+ *   Flag to switch between print_r() and var_export() for data conversion to
+ *   string. Set $print_r to TRUE when dealing with a recursive data structure
+ *   as var_export() will generate an error.
+ */
+function debug($data, $label = NULL, $print_r = FALSE) {
+  // Print $data contents to string.
+  $string = $print_r ? print_r($data, TRUE) : var_export($data, TRUE);
+  trigger_error(trim($label ? "$label: $string" : $string));
+}
+
+/**
  * Parse a dependency for comparison by drupal_check_incompatibility().
  *
  * @param $dependency
