php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65371 strftime() returns insufficient string
Submitted: 2013-08-01 11:42 UTC Modified: 2014-01-11 13:39 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:1 of 2 (50.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kenji dot uui at gmail dot com Assigned: ab
Status: Assigned Package: Date/time related
PHP Version: 5.5.1 OS: Windows
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-08-01 11:42 UTC] kenji dot uui at gmail dot com
Description:
------------
strftime() breaks UTF-8 Japanese characters.

It worked fine in PHP 5.4.

Test script:
---------------
<?php
function p($str)
{
  echo $str, '<br>';
  echo strftime($str), '<br>';
  echo bin2hex($str), '<br>';
  echo bin2hex(strftime($str)), '<hr>';
}

setlocale(LC_ALL, 'C');
p('あ');


Expected result:
----------------
あ
あ
e38182
e38182


Actual result:
--------------
あ
ぁE
e38182
e3818145


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-02 13:52 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2014-01-02 13:52 UTC] ab@php.net
Please check with bug #65184, the issue your report looks very similar and is most likely already fixed.

Thanks.
 [2014-01-02 13:53 UTC] ab@php.net
-Assigned To: +Assigned To: ab
 [2014-01-07 05:21 UTC] kenji dot uui at gmail dot com
I've checked PHP 5.5.6, but not yet fixed. Thanks.

Results:
----------------
あ
ぁE
e38182
e3818145
 [2014-01-09 12:36 UTC] ab@php.net
Ok, sadly I can't reproduce it neither with 5.4 nor with 5.5, got your expected result with CLI and built-in server. There has to be something in your env causing this. Maybe you could try on some other machine, with some other locale, etc? Also note that under apache the locale is not thread safe (as apache under windows is threads based), there it might be possible because of it.

Thanks.
 [2014-01-11 13:39 UTC] kenji dot uui at gmail dot com
-Status: Feedback +Status: Assigned
 [2014-01-11 13:39 UTC] kenji dot uui at gmail dot com
I found Windows system locale affects the result.
I changed it to English(US), then I got expected result.

The problem occurs in Japanese locale.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 14:02:33 2014 UTC