ID: 29383 Comment by: mcknightj at lovullo dot com Reported By: gunther at ultraconsulting dot com Status: No Feedback Bug Type: MSSQL related Operating System: Windows 2000 PHP Version: 4.3.7, 5.0.0 New Comment:
Not sure if I missed where this was addressed, but I'm having this problem after upgrading from 4.3.2 to 4.3.11. We're using php on windows 2003 IIS and have reviewed both this bug report and bug #29292 (listed as bogus). Reviewing the problem it looks like an empty column is being returned as a single space value. Null values are being correctly returned but empty varchar fields are not. I have reviewed the data in enterprise manager, php through IIS, ????, and access through ODBC. In all the cases null's are reported as nulls, strings as strings and empty columns as empty columns (except php). This is probably a problem with the windows db library and not php but it would be easier to correct here rather then php code until microsoft updates their library. Here is an example of what results we get. DATA: id | name ============================== 1 | 'my name' 2 | <NULL> 3 | '' PHP: [echo $result['id']." - '".$result['name']."'";] 1 - 'my name' 2 - '' 3 - ' ' The change happened around 4.3.4 with the following change in php_mssql.c: #if ilia_0 while (length>0 && data[length-1] == ' ') { /* nuke trailing whitespace */ length--; } #endif Maybe this could be updated to the following to handle the single space problem with empty strings: if (length == 1 && data[0] == ' ') { /* nuke whitespace from empty string */ length = 0; data = ''; } Please let me know if you need any additional info or let me know if a work around is already present (other then reverting back to 4.3.3). Previous Comments: ------------------------------------------------------------------------ [2004-12-21 01:00:12] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2004-12-13 07:30:15] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2004-11-05 09:43:15] dcrignon at adequasys dot com I exaclty have the same problem! In our intranet Php Solution, we can't upgrade from php 4.3.3 if we use mssql database. With Oracle or MySql, no problem, we can go to 4.3.9 or 5.0. Now, a new element. On a customer installation, we need Apache 2.0.52 with SSL and in that case, PHP 4.3.3 is really unstable... So we need to go to 4.3.8 or 4.3.9 but we can't, because of MSSQL bug with this space returned instead of empty string !!! Please PHP Team, any solution ??? Thanks, David ------------------------------------------------------------------------ [2004-09-30 12:52:06] andreyra at chtivo dot ru I have the same experience on version 4.3.8 - 4.3.9. Thank for advice to use dll from version 4.3.2. It really solves a problem :). ------------------------------------------------------------------------ [2004-09-22 02:35:53] gunther at ultraconsulting dot com It seems this problem is a long term problem as it was first reported a year ago. Not quite sure why the developers are tagging these reports as 'Bogus'. Everybody using PHP 4.3.3 and higher and MSSQL is affected. The problem is definetely in the php_mssql.dll as the version 4.3.2 dll is working fine, even with PHP 4.3.8. There is no way to upgrade to PHP 5.0.x as the functioning dll doesn't work with 5.0. Any clues if and when this bug will be fixed? Or at least a workaround for this bug without changing thousands of lines of code withing the application. ------------------------------------------------------------------------ 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/29383 -- Edit this bug report at http://bugs.php.net/?id=29383&edit=1