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
This seems to take care of it.
#2
Good catch.
I have déjà vu here.
Oh right... http://drupal.org/node/117630
Thanks, Angie. :-)
#3
#4
assigned to webchick.
#5
Automatically closed -- issue fixed for two weeks with no activity.