[drupal-devel] PHP 101: isset() does not check for zero length (empty) strings

Steve Dondley sdondley at gmail.com
Fri Oct 14 02:36:20 UTC 2005


I literally spent hours trying to track this down (running Drupal
4.6.3).  Please take a moment to review my findings.

I was having a problem with the bug at http://drupal.org/node/20795 (I
beg to differ that it is fixed as reported, by the way) on a couple of
different feeds.

The problem went away when I changed the following line in
node_invoke_nodeapi() from:

else if (isset($result)) {

to this:

else if (isset($result)  && $result != '') {

The problem, of course,  was is that isset() returns true on an empty
string.  This caused an undesirable result in this particular
instance.

I've seen this bug elsewhere in Drupal's code.  Should we be going
through Drupal's code and fixing this problem which is probably pretty
common?


--
Dondley Communications
http://www.dondleycommunications.com

Communicate or Die: American Labor Unions and the Internet
http://www.communicateordie.com



More information about the drupal-devel mailing list