ID: 26315 Comment by: tomasz at biznespolska dot pl 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:
In my opinion this is bug, and is still present on version 4.3.6. This is not only problem with CHAR, and NCHAR columns but also empty VARCHAR columns returns space. Example: $re = mssql_fetch_row(mssql_query("SELECT CAST('' AS VARCHAR(10))")); print('--'.$re[0].'--'); // the result is: -- -- // and should be: ---- Because of that I still use PHP4.3.3. Previous Comments: ------------------------------------------------------------------------ [2004-03-24 04:33:03] francois dot zietlow at ri-solution dot com The Protocol have been changed. Quote from Sybase Doco. [quote] The empty string ("") is treated as a single space. In *char* and *nchar* *not null* columns, the result is a (column-length) field of spaces. [/quote] Found on Bug Report: http://bugs.php.net/bug.php?id=6527 Its not nice... Just I write my own empty-Function..... Francois ------------------------------------------------------------------------ [2004-03-24 04:18:11] francois dot zietlow at ri-solution dot com I think that is a Bug, too. I have the same Problem. It's not a solution to trim any value. Or?? @iliaa: Please write why do you think it's not a Bug. Thanks! Francois ------------------------------------------------------------------------ [2004-03-16 13:29:50] webmaster at groupphotographers dot com THIS most DEFINITELY is a BUG! I have built a VERY LARGE DB driven PHP site. In many places, I check to see if the DB field was empty or not. Before, Fetch always returned an empty string or a NULL, it doesn't matter which because it evaluated to a FALSE, and now it returns a space character which evaluates to TRUE! This is quite nasty. I'm going to add this ME TOO comment because it hasn't been fixed yet, and it really needs to be...PLEASE! ------------------------------------------------------------------------ [2004-02-26 01:47:10] dneilsen at iprimus dot com dot au 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. ------------------------------------------------------------------------ [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) ------------------------------------------------------------------------ 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/26315 -- Edit this bug report at http://bugs.php.net/?id=26315&edit=1