[PHP-users 17798]strftime のバグ報告

airwhite airwhite @ airwhite.net
2003年 9月 10日 (水) 23:49:40 JST


みなさん、こんばんは。airwhite です。

既に既出かもしれませんがバグ?を見つけたのでご報告しておきます。
英語が苦手なので本家にはコンタクトをとっていません。
使っているPCが古いのでもしかしたらメモリーにエラーがあるのかもしれません。
試した環境は、Windows XP Professional SP1、Apache 1.3.28、PHP4.3.3(4.3.2でも
発生)です。

Smarty 2.5 で {html_select_date} を使用中に発見しました。
{html_select_date month_format="%m月"} のように月のフォーマットを指定して展
開すると

<option label="01月*****" value="01">01月*****</option>
<option label="02月*****" value="02">02月*****</option>

***** の部分に余計な文字が付加されて文字化けを起こします。
文字化けの文字列は、一定ではありません。
ブラウザー上でリロードすると違う文字化けが表示されます。

最初は、Smartyのバグかと思ったのですが、ソースを追っていくとstrftime関数で
異常文字変換が発生しているのがわかりました。

他の人は、文字化けは起こっていないでしょうか?

以下、ソースコードは、EUC-JPです。

--- test.php ---------------------------------------------
<?php
require_once('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = 'temp/';
$smarty->compile_dir  = 'temp_c/';
$smarty->config_dir   = 'config/';
$smarty->cache_dir    = 'cache/';
$smarty->display("test.tpl");
?>
----------------------------------------------------------

--- test.tpl ---------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
</head>
<body>
<form name="f1" method="POST" action="test.php">
開始日付:
{html_select_date end_year="+1" field_separator=" " month_format="%m月"
 day_format="%d日" prefix="Start_"}<br />
終了日付:
{html_select_date end_year="+1" field_separator=" " month_format="%m月"
 day_format="%d日" prefix="End_"}<br />
<input type="submit" value=" 修正 " name="B1">
</form>
</body>
</html>
----------------------------------------------------------



PHP-users メーリングリストの案内