← Back to team overview

drizzle-discuss team mailing list archive

Re: PHP's gaping holes with NULL and why should Drizzle care?

 

On 11/06/10 18:53, Brian Moon wrote:
Seems like having the php driver perhaps have a behavior more like what
you want it to have would be better? As-in- perhaps we can get the
php-drizzle driver to not set the variable to null when it gets a null
on a datetime column?

Perhaps, but, what should it be? I mean, the field is NULL. The only
logical thing for the variable to be in PHP is NULL. Can't be empty
string. Not the same. It is complicated by PHP's loose typing of course.
It can all be worked around with enough verbosity. You can't simply say:

if($var === null) or if(is_null($var))

Both of those will throw a NOTICE error if $var has not be assigned
anything. And to make it worse, you can't check isset().

(Note that I have tried this) Doesn't using empty() combined with an __isset overload work? In theory if you get past this you could then you could do is_null() testing and there would be no Notice.

Kind Regards
--
Andrew Hutchings - LinuxJedi - http://www.linuxjedi.co.uk/
Certified MySQL Developer, DBA & Cluster DBA
Zend PHP5 Certified Engineer



References