Re: Re: Release process
| From: | David Croft | Date: | Fri, 04 May 2001 00:42:51 +0000 |
| Subject: | Re: Re: Release process | ||
| References: | 1 | Groups: | php.dev php.qa |
| Request: | Send a blank email to php-dev+get-53762@lists.php.net to get a copy of this message | ||
On Thu, 3 May 2001, Andi Gutmans wrote:
> At 08:53 AM 5/3/2001 -0500, Andrei Zmievski wrote:
> >Um, but some db extensions return NULL values as part of the array, so
> >if column 'foo' is NULL in the db, you'd want the result array to have
> >NULL under key 'foo' - it just won't do to have that column be missing.
>
> Yeah but you can use === NULL for those.
> You might be right but I remember we decided it's problematic.
With all due respect Andi, you can't. There is a difference between a
field being null and that field not existing at all that neither isset,
empty nor === will detect.
david@papaya:~$ php
<?
$arr['field'] = null;
$r1 = ($arr['field'] === null);
$r2 = ($arr['blah'] === null);
var_dump($r1);
var_dump($r2);
$r1 = (isset($arr['field']));
$r2 = (isset($arr['blah']));
var_dump($r1);
var_dump($r2);
$r1 = (empty($arr['field']));
$r2 = (empty($arr['blah']));
var_dump($r1);
var_dump($r2);
$r1 = (key_exists('field', $arr));
$r2 = (key_exists('blah', $arr));
var_dump($r1);
var_dump($r2);
?>
Out of the four, only key_exists makes the distinction.
I know you had mentioned a problem with Zend not being able to unset
certain fields and instead setting them to null. May I suggest instead
that be attended to - if nothing else, by adding a new 'does not exist'
marker to the bucket that the zend_hash_ functions will recognize.
In the meantime a very large note can be added to the documentation if you
are able to determine exactly what circumstances cause this behaviour.
Cheers,
David
--
|> /+\ \| | |>
David Croft
Infotrek