[development] node_get_types() D5 and php5

Carl Mc Dade carl_mcdade at yahoo.com
Wed Feb 14 12:06:15 UTC 2007

This is more of a f.y.i post because I have no idea if the function was changed. But using node_get_types() returns an object that cannot go to string in this code

foreach(node_get_types() as $type => $name) {
    $form[$set][REPORTPOST_NODE_TYPE . $type] = array(
      '#type' => 'checkbox',
      '#title' => t($name),
      '#return_value' => 1,
      '#default_value' => variable_get(REPORTPOST_NODE_TYPE . $type, 0),

 which causes this error:
Object of class stdClass could not be converted to string in F:\wamp5\www\drupal-5.1\includes\form.inc on line 1301.

and had to be changed to $name->name. This is not the case in 4.7 for the same code on the same server. This should be noted on the upgrade docs if anyone can confirm. I am not sure if it should be considered a bug as it may have been a designed change.

php5,mySQL5, Apache2, Windows2000
 Carl Mc Dade
Web Developer


Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070214/c8d95b60/attachment.htm 

More information about the development mailing list