By hedroom on
Running Drupal 5.1 on Windows 2003 and IIS:
Everything is working fine except when a non-existent node number is put into the querystring, a php error is returned to to log:
Example:
http://www.example.com/index.php?q=node/410
Will return
Invalid argument supplied for foreach() in C:\Inetpub\Dept Web Site\includes\common.inc(1342) : eval()'d code on line 12.
if
node/410 is not a valid node id
This is more of an annoyance than anything else but it seems that some webbots go looking for non-existent nodes and "load up" my error log...
Thanks
Wade
Comments
Do you have any custom PHP
Do you have any custom PHP code in your blocks? If so, please post it.
custom PHP code
All of my blocks are created by the views module, with the exception of 3 others (Navigation, Login & Who's Online). I did load the DHTML Menus module and I'm using the DHTML-Navigation block as is.
This is the "Page specific visibility settings" code for the blocks created by the Views Module (added after the block is created)
Thanks,
Wade
That would do it
If you're on a node/### page for a node that doesn't exist, the node_load() will fail and $node->taxonomy won't be there. Try this:
That fixed it
Thanks John!
That was the problem... Your revised code did the trick.
The original code was taken form the "PHP snippets" section of the Customization handbook (http://drupal.org/node/69076).
I'll post your code there.
Also, even though no errors are thrown now, the system just returns the taxonomy list (?q=taxonomy/term/11) of the front page term instead of "page not found" [when a non-existent node is requested].
I had 39 blocks with the "defective" code. Here is the sql statement I used to fix it:
Thanks again,
Wade