From:             jelenkovic at siol dot net
Operating system: Windows XP SP2
PHP version:      4.4.0
PHP Bug Type:     MSSQL related
Bug description:  SPACE BEING RETURNED INSTEAD OF NULL 

Description:
------------
the mssql query keeps returning a space value instead of NULL or EMPTY on
a nvarchar field which is clearly EMPTY.
This bug has been reported before.Has been marked as closed.
The posts bellow it still say it shouldn't be closed since this is an
actual bug.
And since i don't see the logic in making me check every field for a space
value...i'm gonna call this a bug also.
Unless someone knows how to configure PHP to stop acting this way.

Oh i use php ADODB...which is not responsible for this problem.

tested on the following SQL SERVERS..before you scream "wrong mssql
library"

a)Microsoft SQL Server  2000 - 8.00.760 (Intel X86)   Dec 17 2002 14:22:05
  Copyright (c) 1988-2003 Microsoft Corporation  Desktop Engine on Windows
NT 5.1 (Build 2600: Service Pack 2) 

b)Microsoft SQL Server  2000 - 8.00.2039 (Intel X86)   May  3 2005
23:18:38   Copyright   1988-2003 Microsoft Corporation  Standard Edition
on Windows NT 5.2 (Build 3790: Service Pack 1) 

and the php version is 4.4.0 so there is no "old version" problem here.

Reproduce code:
---------------
$query="SELECT * FROM users where username='$username' AND id='$userid'";
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$results = $db->GetAll($query);
foreach ($results as $data)
{
$id= $data["id"];
$city = $data["city"];
if($city=="") { echo "$id)AAAAAAAAAAAAAAAAAAAAAAA<br>"; }
}
dbclose();

Expected result:
----------------
AAAAAAAAAAAAAAAAAAAAAAA where the city field is empty?

Actual result:
--------------
NOTHING

-- 
Edit bug report at http://bugs.php.net/?id=34096&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34096&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34096&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34096&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34096&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34096&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34096&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34096&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34096&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34096&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34096&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34096&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34096&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34096&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34096&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34096&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34096&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34096&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34096&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34096&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34096&r=mysqlcfg

Reply via email to