Object of class stdClass could not be converted to string em /etc/drupal6/all/modules/drupal.org/nodewords/nodewords.module na linha 77.
This is caused by the following line on nodewords.module:
$bool = (
isset($form['type']) &&
isset($form['type']['#value']) &&
$form_id == $form['type']['#value'] . '_node_form' &&
isset($form['#node']) &&
variable_get('nodewords_edit_metatags_' . $form['type']['#value'], TRUE)
);
The PHP warning is generated if you have any form in your installation which store something in a 'type' item's value that are not a scalar. E.g.:
$form['type'] = array(
'#value' => $my_object
);
The attached patch fixes the error message by testing if the variable is scalar before concatenation.
Comments
Comment #1
flaviovs commentedOops... here goes the patch.
Comment #2
avpadernoHello flaviovs, and thanks for your report.
The fix for this issue is a little different, and involves just a re-ordering of the code. In fact, a similar check is done from Drupal core modules, but they don't check if the value is a scalar. They simple access
$form['type']['#value']once they verified$form['#node']is defined; in that case, they are sure the form is the correct one.I am going to change that code.
Comment #4
avpadernoThe code has been changed, and committed in CVS (#324602).
Comment #5
flaviovs commented@kiamlaluno, thanks for pointing it out. In fact, I was not very confortable with that solution -- yes, some code reordering might well fix the problem, but I just wanted to keep the patch as simple as possible. Your solution is much more elegante.