From: [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version: 4.2.3
PHP Bug Type: MSSQL related
Bug description: Trailing null character after mssql datetime field
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 bug report at http://bugs.php.net/?id=20911&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20911&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20911&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20911&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20911&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20911&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20911&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20911&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20911&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20911&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20911&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20911&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20911&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20911&r=isapi