strtotimeでハマる

64bitでも2038年(unixtimestamp:2147483647)までなのね。。。
追記 PHP5.2.6からは2147483647以降のtimestampも大丈夫なようです。
https://bugs.php.net/bug.php?id=44209

<?php
echo PHP_INT_MAX;
# 9223372036854775807

な環境でsmarty内のこんなコードが、、、

{"'2102-11-08'|date_format:"%Y/%m/%d"}

2012/11/05
と本日の日付で出る。

× 2102
○ 2012
のタイポなのだけど。以下、調査。

modifier.date_format.phpの中で

$timestamp = smarty_make_timestamp($string);

という関数を使用している
shared.make_timestamp.phpの中

$time = strtotime($string);
if ($time == -1 || $time === false) {
    // strtotime() was not able to parse $string, use "now":
    $time = time();
}

strtotime を使用後、timestampが取得出来なければ、現在のtimestampを取得している。

<?php
print strtotime("2012-11-08") . "\n";
print strtotime("2037-11-08") . "\n";
print strtotime("2038-11-08") . "\n";
print strtotime("+90 year") . "\n";

とすると

1352300400
2141218800
(false)
(false)

となる。64bitでもダメなのね。。。