#26012 [Bgs]: mssql_fetch_array
| From: | boccara at netvision dot net dot il | Date: | Wed, 29 Oct 2003 17:07:25 +0000 |
| Subject: | #26012 [Bgs]: mssql_fetch_array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49619@lists.php.net to get a copy of this message | ||
ID: 26012
User updated by: boccara at netvision dot net dot il
Reported By: boccara at netvision dot net dot il
Status: Bogus
Bug Type: MSSQL related
Operating System: win2k SBS SP4 & Apache 2.0.47
PHP Version: 4.3.4RC2
New Comment:
the bug 25777 tell that php did a trim of the data, and now it's fix.
I did this request in the transact sql:
select DATALENGTH(rtrim(a)) from test
I got 0 for all lines.
I also did
select DATALENGTH(a) from test
I also got 0 for all lines.
I ONLY got a space caractere when I do the request with php.
I think you should really take a look deeper in your code source.
REM: the only way to avoid the problem with 4.3.4 rc2 is to fill the
blank column with <NULL>.
Previous Comments:
------------------------------------------------------------------------
[2003-10-29 09:09:12] sniper@php.net
I told you already: Bug #25777 was fixed in 4.3.4RC2..
------------------------------------------------------------------------
[2003-10-29 03:08:16] boccara at netvision dot net dot il
I agree with you, but why I only have this problem with the 4.3.4RC2
version ???????
I remind you that it works with 4.3.4RC1 and older version !
------------------------------------------------------------------------
[2003-10-28 17:32:14] fmk@php.net
The C API provided from Microsoft is the problem in this cse. An ampty
column is returned as a single space and not as a true empty column (a
string with length 0). It is not possible to see the difference between
an empty column and a column with a single space.
In this case it is a bug, but not in PHP! As stated before the PHP
extensions sould not attempt to 'fix' data but just present them as is.
------------------------------------------------------------------------
[2003-10-28 15:38:02] boccara at netvision dot net dot il
I made some change, and let me tell you that uou have a BIG bug.
I returned to 4.3.4RC2
I made a request WITHOUT any RTRIM
my data are defined as varchar(100) and NOT as char.
I have located where there is a problem:
query : select a from table test
( a is varchar(100))
when a is blank (without any caractere but not null ) it return the
ascii code 32 wich is a space.
if it is not a BUG I would like to understand what it is ???
------------------------------------------------------------------------
[2003-10-28 14:09:46] fmk@php.net
This fix makes fetching on char() columns work differently that it used
to.
MMSQL Server and other RDBMS's patches the data in a char() column with
trailing spaces. When data are fetched with the new version of the
extension these extra spaces are returned.
A char() column is a fixed length datatype so the database adds extra
spaces when the content is shortar than the defined length. Using a
varchar() column is a way to avoid this problem.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26012
--
Edit this bug report at http://bugs.php.net/?id=26012&edit=1