#32022 [Opn->Bgs]: Wrong implementation of mssql.datetimeconvert=Off
| From: | fmk@php.net | Date: | Fri, 18 Feb 2005 15:20:10 +0000 |
| Subject: | #32022 [Opn->Bgs]: Wrong implementation of mssql.datetimeconvert=Off | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74274@lists.php.net to get a copy of this message | ||
ID: 32022
Updated by: fmk@php.net
Reported By: akukula at navopgd dot pl
-Status: Open
+Status: Bogus
Bug Type: MSSQL related
Operating System: Mandrake Linux 10.1
PHP Version: 4.3.8
New Comment:
FreeTDS should be compiled using --enable-msdblib if you are compiling
php with --with-mssql.
Previous Comments:
------------------------------------------------------------------------
[2005-02-18 16:03:22] akukula at navopgd dot pl
Description:
------------
Turning off mssql.datetimeconvert causes dates returned from SQL
queries to be shifted one month back.
The bug is in line 892 of php_mssql.c,v 1.86.2.41
According to description found in:
<http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@Generic__BookTextView/15105;pt=39614>
dbdatecrack() returns month in range 0...11. So in sprintf() the
argument dateinfo.month should become dateinfo.month+1
Reproduce code:
---------------
mssql_query("SELECT CONVERT(DATETIME, '2005-01-01')");
$a = mssql_fetch_row($res); echo $a[0] . "\n";
mssql_query("SELECT CONVERT(DATETIME, '2005-12-01')");
$a = mssql_fetch_row($res); echo $a[0] . "\n";
Expected result:
----------------
2005-01-01 00:00:00
2005-12-01 00:00:00
Actual result:
--------------
2005-00-01 00:00:00
2005-11-01 00:00:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32022&edit=1