diff -u b/modules/filter/filter.module b/modules/filter/filter.module --- b/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -773,11 +773,13 @@ return ''; } + $text = (string) $text; + // Check for a cached version of this piece of text. $cache = $cache && !empty($format->cache); $cache_id = ''; if ($cache) { - $cache_id = $format->format . ':' . $langcode . ':' . hash('sha256', (string) $text); + $cache_id = $format->format . ':' . $langcode . ':' . hash('sha256', $text); if ($cached = cache_get($cache_id, 'cache_filter')) { return $cached->data; } @@ -785,7 +787,7 @@ // Convert all Windows and Mac newlines to a single newline, so filters only // need to deal with one possibility. - $text = str_replace(array("\r\n", "\r"), "\n", (string) $text); + $text = str_replace(array("\r\n", "\r"), "\n", $text); // Get a complete list of filters, ordered properly. $filters = filter_list_format($format->format); diff -u b/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test --- b/modules/taxonomy/taxonomy.test +++ b/modules/taxonomy/taxonomy.test @@ -1915,24 +1915,6 @@ $output = token_replace($input, array('vocabulary' => $this->vocabulary), array('language' => $language, 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized taxonomy vocabulary token %token replaced.', array('%token' => $input))); } - - // Verify that tokens are generated for terms with empty description. - $term1->description = ''; - taxonomy_term_save($term1); - $term2->description = NULL; - taxonomy_term_save($term2); - - // Generate and test sanitized tokens. - $tests = array(); - $tests['[term:description]'] = ''; - - foreach ($tests as $input => $expected) { - $output = token_replace($input, array('term' => $term1), array('language' => $language)); - $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); - - $output = token_replace($input, array('term' => $term2), array('language' => $language)); - $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); - } } } @@ -1966,6 +1948,24 @@ $output = token_replace($input, array('vocabulary' => $this->vocabulary), array('language' => $language, 'sanitize' => FALSE)); $this->assertEqual($output, $expected, format_string('Unsanitized taxonomy vocabulary token %token replaced.', array('%token' => $input))); } + + // Verify that tokens are generated for terms with empty description. + $term1->description = ''; + taxonomy_term_save($term1); + $term2->description = NULL; + taxonomy_term_save($term2); + + // Generate and test sanitized tokens. + $tests = array(); + $tests['[term:description]'] = ''; + + foreach ($tests as $input => $expected) { + $output = token_replace($input, array('term' => $term1), array('language' => $language)); + $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); + + $output = token_replace($input, array('term' => $term2), array('language' => $language)); + $this->assertEqual($output, $expected, format_string('Sanitized taxonomy term token %token replaced.', array('%token' => $input))); + } } }