diff --git a/includes/theme.inc b/includes/theme.inc index 3868334..139ad28 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2012,7 +2012,7 @@ function theme_more_help_link($variables) { * - title: A descriptive title of the feed. */ function theme_feed_icon($variables) { - $text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title'])); + $text = t('Subscribe to !feed-title', array('!feed-title' => $variables['title'])); if ($image = theme('image', array('path' => 'misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) { return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text))); } diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index a643ff9..bbdb8c5 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -2488,3 +2488,30 @@ class DrupalAddFeedTestCase extends DrupalWebTestCase { return $generated_pattern; } } + +/** + * Test for theme_feed_icon(). + */ +class FeedIconTest extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'Feed icon', + 'description' => 'Check escaping of theme_feed_icon()', + 'group' => 'System', + ); + } + + /** + * Check that special characters are correctly escaped. Test for issue #1211668. + */ + function testFeedIconEscaping() { + $variables = array(); + $variables['url'] = 'node'; + $variables['title'] = '<>&"\''; + $text = theme_feed_icon($variables); + preg_match('/title="(.*?)"/', $text, $matches); + $this->assertEqual($matches[1], 'Subscribe to &"'', 'theme_feed_icon() escapes reserved HTML characters.'); + } + +}