Edit report at https://bugs.php.net/bug.php?id=65184&edit=1
ID: 65184
Comment by: k-yamashita at ver2 dot jp
Reported by: k-yamashita at ver2 dot jp
Summary: strftime() returns insufficient-length string under
multibyte locales
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Windows
PHP Version: 5.5.0
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
It works fine. Thanks a lot!
Well, checking byte values will fail if unit test is performed on other than
Wednesday. I suggest just checking the length.
--FILE--
<?php
setlocale(LC_ALL, 'Japanese_Japan.932');
echo strlen(strftime('%A')) . "\n";
?>
===DONE===
--EXPECT--
6
===DONE===
Previous Comments:
------------------------------------------------------------------------
[2013-07-03 09:30:03] [email protected]
@k-yamashita please test the next snapshot.
Thanks.
------------------------------------------------------------------------
[2013-07-03 09:25:30] [email protected]
Automatic comment on behalf of ab
Revision:
http://git.php.net/?p=php-src.git;a=commit;h=5324416b6514b6de53e7de269bc18b5807701051
Log: Fixed bug #65184 strftime() returns insufficient-length
------------------------------------------------------------------------
[2013-07-02 15:50:55] k-yamashita at ver2 dot jp
Description:
------------
VC11's strftime() returns number of wide characters rather than bytes but PHP
seems to rely on it to determine byte length.
http://connect.microsoft.com/VisualStudio/feedback/details/766205/vs2012-strftime-has-incorrect-return-value-in-vc-11-with-multibyte-codepages
Test script:
---------------
<?php
setlocale(LC_ALL, 'Japanese_Japan.932');
echo strftime('%A');
Expected result:
----------------
>php a.php | od -t x1
0000000 90 85 97 6a 93 fa
0000006
Above is Shift JIS encoded Japanese word for "Wednesday". Other week days are
all 6 bytes long too.
Actual result:
--------------
>php a.php | od -t x1
0000000 90 85 97
0000003
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65184&edit=1