ID:               20911
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Feedback
 Bug Type:         MSSQL related
 Operating System: Windows 2000
 PHP Version:      4.2.3
 New Comment:

When using the latest snapshot for Windows:

   http://snaps.php.net/win32/php4-win32-latest.zip

dated Dec 10, 2002, the error doesn't seem to occur.  That
is, the output of my test script doesn't contain a trailing
null character:

   2002-12-31 00:00:00|19|48


Previous Comments:
------------------------------------------------------------------------

[2002-12-09 11:26:28] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip



------------------------------------------------------------------------

[2002-12-09 11:21:07] [EMAIL PROTECTED]

When selecting a datetime field from mssql while the
following setting is active:

   ini_set('mssql.datetimeconvert', 0);

the field contains a trailing null character which causes
havoc when generating XML. 

Environment: SQL Server 2000

A workaround is to select the datatime field as CAST(.. AS CHAR). 

Example script to reproduce the problem: 

   ini_set('mssql.datetimeconvert', 0);
   $iLinkId = mssql_connect('server', 'username', 'pwd');
   mssql_select_db('database', $iLinkId);
   $iResultId = mssql_query(
     'SELECT TESTDATE FROM TEST WHERE TEST_ID = 1'
   );
   $aRow = mssql_fetch_array($iResultId);
   print $aRow[0] . '|';
   print strlen($aRow['TESTDATE']);
   print '|';
   print ord(
     $aRow['TESTDATE'][strlen($aRow['TESTDATE']) - 1]
   );
   print '<br>';
   mssql_close($iLinkId)

The output looks like this: 

   2002-12-31 00:00:00|20|0

indicating the string is 20 characters long, and the last character is
a null character (\0).

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=20911&edit=1

Reply via email to