ID: 32022 User updated by: akukula at navopgd dot pl Reported By: akukula at navopgd dot pl Status: Bogus Bug Type: MSSQL related Operating System: Mandrake Linux 10.1 PHP Version: 4.3.8 New Comment:
Mandrake have not used --enable-msdblib in their RPM. Previous Comments: ------------------------------------------------------------------------ [2005-02-19 01:49:22] akukula at navopgd dot pl Okay this one is bogus. There are conflicting prototypes for dbdatecrack(3) in Sybase and SQL Server. Sybase requires month to be an offset 0-11 and SQL Server says it should be a proper month 1-12. So if you use SQL Server and not Sybase, be sure to compile FreeTDS with --enable-msdblib, as suggested by PHP documentation, to get proper dates in PHP. If you need more details, see this: <http://lists.ibiblio.org/pipermail/freetds/2002q3/008336.html> ------------------------------------------------------------------------ [2005-02-18 16:39:53] akukula at navopgd dot pl This is not bogus and I ask you to apply this simple fix. This sprintf() violates dbdatecrack() specification. sprintf() prints invalid date and recompilation of external library is not a fix. ------------------------------------------------------------------------ [2005-02-18 16:20:08] [EMAIL PROTECTED] FreeTDS should be compiled using --enable-msdblib if you are compiling php with --with-mssql. ------------------------------------------------------------------------ [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