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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | node_module2.patch | 340 bytes | rho_ |
| node_module.patch | 260 bytes | rho_ |
Comments
Comment #1
rho_ commentedChanging to (code needs work) as I think the check_plain may be deliberate, just unfinished.
Comment #2
rho_ commentedDOH! Well I should really look twice before I diff. My second test above is incorrect it should be:
And trying this all seems well, plus I think it is much more of what is intended. So heres the patch:
Comment #3
asimmonds commentedDuplicate with http://drupal.org/node/206510?
Original issue for the change http://drupal.org/node/206272
Comment #4
webernet commented