#28124 [Com]: Using MSSQL functions an empty string is returned as a space
| From: | kalf at unidial dot com dot au | Date: | Wed, 12 May 2004 05:13:55 +0000 |
| Subject: | #28124 [Com]: Using MSSQL functions an empty string is returned as a space | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59520@lists.php.net to get a copy of this message | ||
ID: 28124
Comment by: kalf at unidial dot com dot au
Reported By: cbunk at arescorporation dot com
Status: Bogus
Bug Type: MSSQL related
Operating System: Windows 2000
PHP Version: 4.3.6
New Comment:
This is not a bogus bug. We also have a similar problem. Returned
strings are being right padded with spaces. The fix for
http://bugs.php.net/bug.php?id=25777 has added a
new bug (using
4.3.4)it appears. When comparing with newer versions of postgres (which
has stricter string comparison rules --pg7.2) this results is false
negatives.
Previous Comments:
------------------------------------------------------------------------
[2004-04-23 17:44:23] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
This is the bug in the mssql library you are using.
P.S. This issue has been discussed in detail in earlier bug
reports about the same issue, please search the bug
archives.
------------------------------------------------------------------------
[2004-04-23 16:15:45] cbunk at arescorporation dot com
Description:
------------
When making a query on a MSSQL DB using mssql functions an extra space
is added to the end of output. This is causing trouble with scripts of
mine that check to see if the querried field is empty to determine
whether or not to display some text.
The bug mentioned at
http://bugs.php.net/bug.php?id=25777
describes the problem but was marked as bogus. I think when the fix
for http://bugs.php.net/bug.php?id=25777 was made
it in advertently
left an extra space in results.
Reproduce code:
---------------
//once connected to the db
$sql="Select name from contacts";
$result=mssql_query($sql);
$row = mssql_fetch_array($result);
//assume there is one entry in the table
//with an empty string as the value for
//name
if (!empty($row["name"])){
echo "Name: " . $row["name"];
}else{
echo "Name value is empty";
}
Expected result:
----------------
Name value is empty
Actual result:
--------------
Name:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28124&edit=1