ID: 28124 Comment by: gunther at ultraconsulting dot com Reported By: cbunk at arescorporation dot com Status: Bogus Bug Type: MSSQL related Operating System: Windows 2000 PHP Version: 4.3.6 New Comment:
I have the same problem! Using an older php_mssql.dll (3/13/2003 or so) solved the problem for me, but might cause other problems. I have PHP 4.3.7 and 5.0.0 and it works fine under 4.3.2. Here my bug comments: A SELECT statement returns instead of an empty value for an empty varchar field, a value containing a single space. Therefore using the PHP empty() function will not work anymore. Problem only happens with php_mssql.dll from year 2004 for PHP version 4.3.7 and 5.0.0. Using a previous dll from 3/13/03 (4.3.2-RC1) for instance solves the problem ... but might cause others. I guess we have to dig in the mssql extension code ... Previous Comments: ------------------------------------------------------------------------ [2004-05-12 07:13:39] kalf at unidial dot com dot au This is not a bogus bug. We also have a similar problem. Returned strings are being right padded with spaces. The fix for http://bugs.php.net/bug.php?id=25777 has added a new bug (using 4.3.4)it appears. When comparing with newer versions of postgres (which has stricter string comparison rules --pg7.2) this results is false negatives. ------------------------------------------------------------------------ [2004-04-23 17:44:23] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. This is the bug in the mssql library you are using. P.S. This issue has been discussed in detail in earlier bug reports about the same issue, please search the bug archives. ------------------------------------------------------------------------ [2004-04-23 16:15:45] cbunk at arescorporation dot com Description: ------------ When making a query on a MSSQL DB using mssql functions an extra space is added to the end of output. This is causing trouble with scripts of mine that check to see if the querried field is empty to determine whether or not to display some text. The bug mentioned at http://bugs.php.net/bug.php?id=25777 describes the problem but was marked as bogus. I think when the fix for http://bugs.php.net/bug.php?id=25777 was made it in advertently left an extra space in results. Reproduce code: --------------- //once connected to the db $sql="Select name from contacts"; $result=mssql_query($sql); $row = mssql_fetch_array($result); //assume there is one entry in the table //with an empty string as the value for //name if (!empty($row["name"])){ echo "Name: " . $row["name"]; }else{ echo "Name value is empty"; } Expected result: ---------------- Name value is empty Actual result: -------------- Name: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28124&edit=1