Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1015 diff -u -p -r1.1015 common.inc --- includes/common.inc 13 Oct 2009 05:37:45 -0000 1.1015 +++ includes/common.inc 13 Oct 2009 18:31:48 -0000 @@ -2579,6 +2579,7 @@ function drupal_attributes(array $attrib */ function l($text, $path, array $options = array()) { global $language_url; + static $bootstrapped = FALSE; // Merge in defaults. $options += array( @@ -2598,7 +2599,28 @@ function l($text, $path, array $options $options['attributes']['title'] = strip_tags($options['attributes']['title']); } - return '' . ($options['html'] ? $text : check_plain($text)) . ''; + $variables = array( + 'text' => $options['html'] ? $text : check_plain($text), + 'href' => check_plain(url($path, $options)), + 'attributes' => $options['attributes'], + ); + if ($bootstrapped || (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL)) { + // Only call theme() if Drupal has been fully bootstrapped. + $bootstrapped = TRUE; + return theme('link', $variables); + } + else { + return theme_link($variables); + } +} + +/** + * Theme an internal Drupal link. + * + * @param $variables + */ +function theme_link($variables) { + return '' . $variables['text'] . ''; } /** @@ -4911,6 +4933,9 @@ function drupal_common_theme() { 'indentation' => array( 'arguments' => array('size' => 1), ), + 'link' => array( + 'arguments' => array('text' => NULL, 'href' => NULL, 'attributes' => array()), + ), // from pager.inc 'pager' => array( 'arguments' => array('tags' => array(), 'element' => 0, 'parameters' => array(), 'quantity' => 9), Index: modules/simpletest/tests/common.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v retrieving revision 1.83 diff -u -p -r1.83 common.test --- modules/simpletest/tests/common.test 11 Oct 2009 02:14:43 -0000 1.83 +++ modules/simpletest/tests/common.test 13 Oct 2009 18:31:49 -0000 @@ -4,7 +4,7 @@ /** * Tests for URL generation functions. */ -class CommonURLUnitTest extends DrupalUnitTestCase { +class CommonURLUnitTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'URL generation tests',