|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26351 Incorrect handling of Null Fields/Numerical Fields with '0'
Submitted: 2003-11-21 11:44 UTC Modified: 2003-11-21 11:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: jabberwocky at ibplanet dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.4 OS: Any
Private report: No CVE-ID: None
 [2003-11-21 11:44 UTC] jabberwocky at ibplanet dot com
With the new MSSQL so-called "bugfix" there seem to be a lot of problems,

first of all, when accessing the DB, and retrieving a field that has a null value in it, a single space (" ") is returned instead of a null string.

This is also the case if you retrieve a numerical value of 0 - instead of retrieving the number 0 - a single space (" ") is returned.

This has caused all sort of problems with the MSSQL Database Driver that I am currently coding for Invision Power Board (

Reproduce code:
Source Code available on request from PHP team by emailing (as this is a paid product)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-21 11:56 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Read previous bug reports regarding this issue.
 [2003-12-17 21:14 UTC] justin22 at v-biz dot net
I concur that this is actually a bug introduced in 4.3.4
I have a varchar field that is null (not empty) that is also being returning a single space.  In version 4.3.3  this same field is returned as an empty string.
Ideally it should be returned as PHP null value, but that could break other peoples programs.

There may be some confusion here related to compatibility issues.  SQL Server 6.5 interpreted a single space as an empty string - see the documentation on sp_dbcmptlevel for a basic introduction.  What 'interpreted' means here i'm not sure, it seems to be just when parsing sql queries.


for possibly more info.

This problem has been reported in bug #26315, #26012 and this one, so I'm not happy with it being regarded as Bogus.

If it is a genuine compatibility issue, then perhaps it should be resolved by creating a new php ini setting that could allow for either compatibility modes.

I've come across this bug when trying to resolve bug #26589, which may also require a modification to the mssql module.

Justin von Perger
 [2003-12-17 21:33 UTC] justin22 at v-biz dot net
I've just further researched the issue with bug #25777 and bug #9854 (back in 2001). If it is the case that the version 6.0 db-library is the problem, then migrating to the freetds library is the best way to advance the mssql extension, as suggested by rmk
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 20:01:31 2024 UTC