#26315 [Com]: mssql_fectch_* functions are returning a space char on empty fields
| From: | dneilsen at iprimus dot com dot au | Date: | Thu, 26 Feb 2004 06:47:10 +0000 |
| Subject: | #26315 [Com]: mssql_fectch_* functions are returning a space char on empty fields | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55586@lists.php.net to get a copy of this message | ||
ID: 26315
Comment by: dneilsen at iprimus dot com dot au
Reported By: webmaster at cbre dot fr
Status: Bogus
Bug Type: MSSQL related
Operating System: Windows 2000 Server
PHP Version: 4.3.4
New Comment:
I too have encountered this bug with windows 2003 server using version
4.3.4 of php.
Where as previously my empty varchar fields where returned as '' they
are now returned as ' ' which has caused several of my applications to
fail.
Previous Comments:
------------------------------------------------------------------------
[2003-12-01 20:29:11] php at electricsurfer dot com
THIS IS A BUG new to 4.3.4.
Introduced by removing the auto-trimming
While the change is a good one, if '' is in the DB, mssql_fetch_*
should NOT return ' '
IN DB: '' (empty string)
Returned by mssql_fetch_assoc(): ' ' (single space)
------------------------------------------------------------------------
[2003-11-21 11:33:13] jabberwocky at ibplanet dot com
also, instead of returning 0 it is now also returning a space if there
is a 0 in the DB
------------------------------------------------------------------------
[2003-11-21 07:56:06] w1lz0r at barrysworld dot net
This is a bug, as there is no space in the database. The change from
not auto-trimming is a good one IMO, but the behaviour of empty fields
is different now.
Any character field which is empty (e.g. '') and not null will be
returned as a space.
My application no longer worked correctly after the 4.3.4 change and I
have to now manually do (if ($field==' ') $field='';). This is a major
change from previous versions and a bug as the mssql functions should
return what is IN the database. Maybe this is the reason why the rtrim
was done in the past?
Please re-evaluate.
------------------------------------------------------------------------
[2003-11-19 09:42:17] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
mssql extension no longer automatically trims varchar fields
------------------------------------------------------------------------
[2003-11-19 07:20:52] webmaster at cbre dot fr
Description:
------------
mssql_fectch_* functions are returning a space char when selecting
empty fields.
The problem does not occur where MSSQL table fields are set to <NULL>
value insteed of empty.
It was not working this way with PHP 4.3.2 and previous versions. I
can't see nothing in the change log about this.
Kind regards
Clement
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26315&edit=1