php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41775 date() using chinese character as a separator
Submitted: 2007-06-22 05:11 UTC Modified: 2007-06-25 09:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rozvinbm_jp at yahoo dot co dot jp Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.3 OS: Windows XP
Private report: No CVE-ID: None
 [2007-06-22 05:11 UTC] rozvinbm_jp at yahoo dot co dot jp
Description:
------------
OS
----
Windows XP Home Edition SP2 Japanese Version with updated hotfixes

PHP.ini changes
----
precision    =  14
output_buffering = 4096
allow_call_time_pass_reference = Off
variables_order = "GPCS"
register_long_arrays = Off
magic_quotes_gpc = Off



Reproduce code:
---------------
It is a jpg file because it maybe the chinese character does not support this forum.
----
http://anime.geocities.jp/rozvinbm_jp/reproducecode.JPG
echo $dt1;
echo $dt2;

Expected result:
----------------
http://anime.geocities.jp/rozvinbm_jp/expectedresult.JPG

Actual result:
--------------
http://anime.geocities.jp/rozvinbm_jp/actualresult.JPG


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-22 08:11 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.
 [2007-06-22 09:20 UTC] rozvinbm_jp at yahoo dot co dot jp
http://anime.geocities.jp/rozvinbm_jp/reproducecode.jpg

This is the revised reproducecode.jpg. I do with jpg file because maybe this forum does not support chinese character to display.
 [2007-06-22 09:28 UTC] rozvinbm_jp at yahoo dot co dot jp
http://anime.geocities.jp/rozvinbm_jp/reproducecode.JPG

I'm sorry for correction (must be all capital JPG). This is the link. Thanks.
 [2007-06-22 09:30 UTC] derick@php.net
Could you send it to me directly (in a zip/targz file)? I can't test it as I can't write Chinese myself :) (address is derick (@) php . net)
 [2007-06-25 08:36 UTC] rozvinbm_jp at yahoo dot co dot jp
I sent you the php file contaning the actual reproduce code for your reference via email. Please acknowledge it if you received or not.
 [2007-06-25 09:40 UTC] derick@php.net
Yes, I got it - and this is not a bug in PHP. The first japanese character (for year) in its Shift-Jis encoding (that's the encoding you were using in the script that you sent me) includes as second byte the "n" character. The "n" character is also a modifier letter for the date() function call. As PHP 4 and PHP 5 do not support Unicode here this does not work. There are two solutions:
1. Encode your scripts in UTF-8
2. break up the date call like:
   echo date("Y", $ts) . "YEARCHAR" . date("m", $ts) . "MONTHCHAR"....
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 05:01:30 2024 UTC