Re: PHP 4.0 Bug #3631: NULL data value not returned as in 3.x when using mysql_fetch_array/row

From: Date: Sat, 26 Feb 2000 02:37:44 +0000
Subject: Re: PHP 4.0 Bug #3631: NULL data value not returned as in 3.x when using mysql_fetch_array/row
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-16030@lists.php.net to get a copy of this message
On 26 Feb 2000 chris@digitaria.com wrote: > From: chris@digitaria.com > Operating system: NT 4.0 SP6a > PHP version: 4.0 Beta 4 Patch Level 1 > PHP Bug Type: MySQL related > Bug description: NULL data value not returned as in 3.x when using mysql_fetch_array/row > > Queries of the form > list($Parent, $CategoryName, $DBTemplate, $SortOrder) = mysql_fetch_array($catinfo); > > no longer work (the exact same code with the exact same database does work with PHP 3.0.7). > > I'll get an error such as > Warning: Undefined offset: 0 in D:\IIS\template-demo\index.php3 on line 88 > > This only happens when a query returns a NULL in one of the columns. Removing the NULL takes > care of this. > > Switching to mysql_fetch_row still results in isset($row[0]) being false, requiring a change to > something unwieldy like (isset($foo[0]) ? $foo[0] : "NULL"); This has been PHP's behavior for quite a while now - it's PHP's special way of denoting a NULL value. If you don't care about being assigned NULL values, you should explicitly ignore warnings by prefixing the list()=mysql_fetch_array() statement with a @ sign. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#16030) next »