After updating my checkout of HEAD this morning I began to notice a warnings when visiting node/add/* they are as follows:

# warning: Missing argument 1 for check_plain() in /Applications/MAMP/htdocs/drupal_head/includes/bootstrap.inc on line 669.
# notice: Undefined variable: text in /Applications/MAMP/htdocs/drupal_head/includes/bootstrap.inc on line 670.

They both occur 3 times. I wiped my db and did a fresh install of head, and the warning persisted. I believe this issue stems from the node module, specifically around line 1426

<?php
    $items['node/add/'. $type_url_str] = array(
      'title' => drupal_ucfirst($type->name),
      'title callback' => 'check_plain',
      'page callback' => 'node_add',
      'page arguments' => array(2),
      'access callback' => 'node_access',
      'access arguments' => array('create', $type->type),
      'description' => $type->description,
      'file' => 'node.pages.inc',
    );
?>

I believe title callback is improperly used here. I attempted to change to:

<?php
    $items['node/add/'. $type_url_str] = array(
      'title callback' => 'check_plain',
      'title arguments' => drupal_ucfirst($type->name),
      'page callback' => 'node_add',
      'page arguments' => array(2),
      'access callback' => 'node_access',
      'access arguments' => array('create', $type->type),
      'description' => $type->description,
      'file' => 'node.pages.inc',
    );
?>

But it produced three new errors, this time from menu. So instead I thought that perhaps the callback was a "leftover" from something else, and did away with it completely:

<?php
     $items['node/add/'. $type_url_str] = array(
      'title' => drupal_ucfirst($type->name),
      'page callback' => 'node_add',
      'page arguments' => array(2),
      'access callback' => 'node_access',
      'access arguments' => array('create', $type->type),
      'description' => $type->description,
      'file' => 'node.pages.inc',
    );
?>

This seems to fix the bug. Double checking with beta 4, I see that this is how the code was originally. So I don't know if the check_plain was intended, but just not completely implemented. Nevertheless heres a patch to take it back to warning-less code.

CommentFileSizeAuthor
#2 node_module2.patch340 bytesrho_
node_module.patch260 bytesrho_

Comments

rho_’s picture

Status: Needs review » Needs work

Changing to (code needs work) as I think the check_plain may be deliberate, just unfinished.

rho_’s picture

Status: Needs work » Needs review
StatusFileSize
new340 bytes

DOH! Well I should really look twice before I diff. My second test above is incorrect it should be:

<?php
    $items['node/add/'. $type_url_str] = array(
      'title callback' => 'check_plain',
      'title arguments' => array(drupal_ucfirst($type->name)),
      'page callback' => 'node_add',
      'page arguments' => array(2),
      'access callback' => 'node_access',
      'access arguments' => array('create', $type->type),
      'description' => $type->description,
      'file' => 'node.pages.inc',
    );
?>

And trying this all seems well, plus I think it is much more of what is intended. So heres the patch:

asimmonds’s picture

Duplicate with http://drupal.org/node/206510?
Original issue for the change http://drupal.org/node/206272

webernet’s picture

Status: Needs review » Closed (duplicate)