ID: 30962 Comment by: erudd at netfor dot com Reported By: richard dot quadling at bandvulc dot co dot uk Status: Open Bug Type: MSSQL related Operating System: Windows XP Pro SP2 PHP Version: 5.0.3 New Comment:
-- The reason I say this, is that if I make the column NULL, -- then I get NULL. If I make the column an empty string -- (i.e. select all and then delete - doing this in -- Enterprise Manager), I get a space in the result set! I recently came across this issue when upgrading to the lastest FreeTDS and the lastet PHP 4.3.x connecting to MS SQL Server 2000. The issue was actualy not php, as it was easily fixed by editing the freetds.conf and set the global "tds version" from 4.2 to 7.0 and the space issue went away. Previous Comments: ------------------------------------------------------------------------ [2005-01-12 21:15:26] public at nexia dot ca I second the request by wchannospam at tomoye dot com to port this bug fix to 4.3.x stream. Its causing major issues for my PHP apps on Windows. ------------------------------------------------------------------------ [2005-01-12 21:02:43] wchannospam at tomoye dot com This problem is also appearing in PHP 4.3.x where x>=4. Can you implement the same fix there as well. Thank you very much. ------------------------------------------------------------------------ [2004-12-16 11:39:16] richard dot quadling at bandvulc dot co dot uk Simple test script to show the problem. <?php $rConn = mssql_connect('localhost','PHPBB_User','PHPBB_User'); $rResults = mssql_query('SELECT username, user_icq, LEN(user_icq) AS user_icq_len FROM PHPBB_User.phpbb_users'); while ($row = mssql_fetch_assoc($rResults)) { echo '<pre>' . var_export($row, True) . '</pre>Length of ' . $row['username'] . '\'s user_icq = ' . strlen($row['user_icq']) . '<br /><br /><br />'; } mssql_free_result($rResults); mssql_close($rConn); ?> Requires phpBB and at least 1 user defined with an ICQ number. Obviously, you could choose any field or any other MS SQL database. Richard. ------------------------------------------------------------------------ [2004-12-16 11:32:42] richard dot quadling at bandvulc dot co dot uk Back again in V5.0.3! Or should that be still here? I notice that the version of the code now tests to see if the length is 0 before the conversion of the data to its appropriate type. Is it possible, that there is a distinction between NULL and 0? My C knowledge says no. NULL is 0, but I may be wrong! The reason I say this, is that if I make the column NULL, then I get NULL. If I make the column an empty string (i.e. select all and then delete - doing this in Enterprise Manager), I get a space in the result set! Argh! Is there ANY way a debug version could be built that reported that the code that has been modified is actually called. I'd really like to know what length IS being returned if the field is empty. I am more than willing to help get this fixed, but I need some hand holding in getting MSVC++ setup appropriately. I do not know what additional tools I need. I am in the process of downloading Cygwin to start some work on the PHP documentation (just getting the CHM compiled first!). ------------------------------------------------------------------------ [2004-12-03 03:27:19] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ 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/30962 -- Edit this bug report at http://bugs.php.net/?id=30962&edit=1