Bug in node_load check

webchick - May 28, 2008 - 18:26
Project:Terms of Use
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

If you visit the registration page before choosing a terms of service node, you get:

    * notice: Trying to get property of non-object in /Applications/MAMP/htdocs/6x2/modules/node/node.module on line 1035.
    * notice: Trying to get property of non-object in /Applications/MAMP/htdocs/6x2/modules/node/node.module on line 1035.
    * notice: Undefined property: stdClass::$body in /Applications/MAMP/htdocs/6x2/modules/node/node.module on line 1038.
    * notice: Undefined property: stdClass::$format in /Applications/MAMP/htdocs/6x2/modules/node/node.module on line 1038.

node_load actually returns FALSE if a node wasn't found, not NULL. so this:

    // Getting the node that contains the Terms of Use
    $node = node_load(variable_get('terms_of_use_node', ''));
    if (isset($node)) {

will return TRUE since FALSE counts as a defined value. Crazy, but true.

#1

webchick - May 28, 2008 - 18:28
Status:active» needs review

This seems to take care of it.

AttachmentSize
terms_of_use-node_load-check-263821-1.patch 1.14 KB

#2

Chill35 - May 29, 2008 - 00:10
Status:needs review» reviewed & tested by the community

Good catch.

I have déjà vu here.

Oh right... http://drupal.org/node/117630

Thanks, Angie. :-)

#3

Chill35 - May 29, 2008 - 00:13
Status:reviewed & tested by the community» fixed

#4

Chill35 - May 29, 2008 - 00:53

assigned to webchick.

#5

Anonymous (not verified) - June 12, 2008 - 01:02
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.