I've reopened a bug report caused by this problem: http://drupal.org/node/20795 On 10/14/05, Steve Dondley <sdondley@gmail.com> wrote:
I was thinking, this problem also stems from the fact that sometimes fields have a NULL value in the database and sometimes are stored as empty strings. We will probably want to settle on a way of storing string in the database, too.
On 10/13/05, Nedjo Rogers <nedjo@gworks.ca> wrote:
Awhile back I posted a similar question, see below. We have a need for some standard guidelines on when to use which test for empty, null, or set variables, arrays, and object properties. _______
I find I'm sometimes not sure which types of test I should apply to test if a variable (or array key) is null or empty.
Looking at the code, I see various usages:
if (is_null($variable)) if (empty($variable)) if ($variable == NULL) if ($variable === NULL) if ($objectname->propertyname) if (array_key_exists($key, $arrayname)) if ($arrayname['key']) etc.
Can anyone point to or suggest a limited set of tests that we should use, and guidelines for when each should be applied? This would be a useful addition to the coding standards, http://drupal.org/node/318. Thanks!
-- Dondley Communications http://www.dondleycommunications.com
Communicate or Die: American Labor Unions and the Internet http://www.communicateordie.com
-- Dondley Communications http://www.dondleycommunications.com Communicate or Die: American Labor Unions and the Internet http://www.communicateordie.com