From:             gunther at ultraconsulting dot com
Operating system: w2k
PHP version:      4.3.7
PHP Bug Type:     MSSQL related
Bug description:  A SELECT statement returns instead of an empty value, a value 
containing space

Description:
------------
A SELECT statement returns instead of an empty value for a varchar field,
a value containing a single space. Therefore using the empty() directive
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.


Reproduce code:
---------------
<?php
$db_host = 'localhost';
$db_user = 'sa';
$db_pass = '';

    if ($dbh = mssql_connect($db_host, $db_user, $db_pass)) {
                print ('<br><br>DB: "'.$db_name.'" connected');
        } else {
                print ("<br>DB NOK ");
                exit;
        } 


 $query = 'SELECT * FROM mydb WHERE id = 1';

  $result = mssql_query($query, $dbh);
  {
      if ($row = mssql_fetch_array($result, MSSQL_ASSOC)) {
          print_r($row);
          print("\n<br>(" . $row['id'] . ')');
      }
  }
?>

Expected result:
----------------
...
()

Actual result:
--------------
...
( )


-- 
Edit bug report at http://bugs.php.net/?id=29383&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29383&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29383&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29383&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29383&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29383&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29383&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29383&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29383&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29383&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29383&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29383&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29383&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29383&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29383&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29383&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29383&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29383&r=float

Reply via email to