For pure code consistency, all tokens that also have a -raw token should be handled like this:

  $tokens['sometoken-raw'] = $somedata;
  $tokens['sometoken'] = check_plain($tokens['sometoken-raw']);

Many tokens handle it like this:

  $tokens['sometoken-raw'] = $somedata;
  $tokens['sometoken'] = check_plain($somedata);

While obviously a minuscule issue, consistency would be worthwhile.

CommentFileSizeAuthor
#5 token-n957940-5.patch8.68 KBDamienMcKenna
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch token-n957940-5.patch. View
#1 token-n957940.patch8.66 KBDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 105 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
8.66 KB
PASSED: [[SimpleTest]]: [MySQL] 105 pass(es). View

A few of them weren't appropriate, e.g. 'bookpath', but this patch will resolve the ones that make sense.

Dave Reid’s picture

Status: Needs review » Needs work
+++ token_comment.inc	30 Oct 2010 21:54:33 -0000
@@ -26,16 +26,14 @@ function comment_token_values($type, $ob
-      $values['comment-body']            = check_markup($comment->comment, $comment->format, FALSE);
-      $values['comment-author-name']     = check_plain($comment->name);
-      $values['comment-author-uid']      = $comment->uid;
-      $values['comment-author-homepage'] = check_url($comment->homepage);
-
-      // Raw counterparts of user supplied data.
       $values['comment-title-raw']       = $comment->subject;
+      $values['comment-title']           = check_plain($values['comment-title-raw']);
       $values['comment-body-raw']        = $comment->comment;

Lost parameters to check_markup() here.

Powered by Dreditor.

Dave Reid’s picture

Hrm, I'm not necessarily sold on why this is necessary? If we've already got the raw variable, does this just improve readability?

DamienMcKenna’s picture

It's completely superfluous and purely for readability. It also helps ensure things like #957934: Are current-page-path and current-page-path-raw backwards? doesn't happen ;-)

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
8.68 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch token-n957940-5.patch. View

Restored the missing check_markup() arguments.

Status: Needs review » Needs work

The last submitted patch, token-n957940-5.patch, failed testing.