[support] bizarre "blank" string with non-zero length

Ray Zimmerman rz10 at cornell.edu
Tue Mar 20 13:05:57 UTC 2007


I have a theme that needs to check if a CCK date field value is  
blank. Initially, I did this with a simple ...

if ($field_datetime_value)

... but since upgrading the date module, I'm getting strange non- 
empty "blank" strings, e.g. something that serializes to s:41:"". So,  
empty($field_datetime_value) returns false, strlen 
($field_datetime_value) returns 41, strcmp($field_datetime_value, "")  
is positive, but the string *is* blank.

So two questions:
(1) How does such a string ever get created (is this a PHP bug)?
(2) If it's not a bug, how does one detect this kind of blank string?

See http://drupal.org/node/128778 for more details.

-- 
Ray Zimmerman
Senior Research Associate
428-B Phillips Hall, Cornell University, Ithaca, NY 14853
phone: (607) 255-9645




More information about the support mailing list