From: robert dot johnson at icap dot com
Operating system: Win XP sp3
PHP version: 5.2.8
PHP Bug Type: Date/time related
Bug description: Calling setlocale causes microseconds to disappear
Description:
------------
I changed locale to Germany, created a datetime with microseconds,
formatted the date, and the microseconds were zero.
This first appeared when SQL 2005 driver showed no microseconds for German
users of my site.
The code is a simple test to show it's not caused by the SQL Server
driver.
Reproduce code:
---------------
$robert = new DateTime('2009-02-04 15:55:25.321');
$robertf = $robert->format(CLocale::DateTimeFormatFull);
echo $robertf . "\r\n";
$robloc = setlocale(LC_ALL, 'German_Germany.1252');
echo $robloc . "\r\n";
$robert = new DateTime('2009-02-04 15:55:25.321');
$robertf = $robert->format(CLocale::DateTimeFormatFull);
echo $robertf . "\r\n";
$robloc = setlocale(LC_ALL, 'English_uk.1252');
echo $robloc . "\r\n";
$robert = new DateTime('2009-02-04 15:55:25.321');
$robertf = $robert->format(CLocale::DateTimeFormatFull);
echo $robertf . "\r\n";;
Expected result:
----------------
04/02/2009 15:55:25.321000
German_Germany.1252
04/02/2009 15:55:25.321000
English_United Kingdom.1252
04/02/2009 15:55:25.321000
Actual result:
--------------
04/02/2009 15:55:25.321000
German_Germany.1252
04/02/2009 15:55:25.000000
English_United Kingdom.1252
04/02/2009 15:55:25.321000
--
Edit bug report at http://bugs.php.net/?id=47312&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47312&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47312&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47312&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47312&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47312&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47312&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47312&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47312&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47312&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47312&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47312&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47312&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47312&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47312&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47312&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47312&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47312&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47312&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47312&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47312&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47312&r=mysqlcfg