From: akukula at navopgd dot pl Operating system: Mandrake Linux 10.1 PHP version: 4.3.8 PHP Bug Type: MSSQL related Bug description: Wrong implementation of mssql.datetimeconvert=Off
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 bug report at http://bugs.php.net/?id=32022&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32022&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32022&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32022&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32022&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32022&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32022&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32022&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32022&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32022&r=support Expected behavior: http://bugs.php.net/fix.php?id=32022&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32022&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32022&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32022&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32022&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32022&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32022&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32022&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32022&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32022&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32022&r=mysqlcfg