开发者

strftime crashing joomla on php5

开发者 https://www.devze.com 2023-03-02 13:20 出处:网络
I\'m trying to modify a part of Joomla 1.0 setup running on PHP 5.1.6 and I\'m having problem with strftime() function. In the code I\'m calling:

I'm trying to modify a part of Joomla 1.0 setup running on PHP 5.1.6 and I'm having problem with strftime() function. In the code I'm calling:

print strftime("%d-%m-%y", '1304184490') . "\n";

which works in a separate .php file just fine. When it's part of the joomla code, the script stops execution exactly on that line. I do not get any message in error log (got error_reporting set to E开发者_运维百科_ALL), no exception is generated, script just stops on that line (verified with print "foo\n" before and after).

What can be the cause of this? I'm not sure about the whole host configuration since it's some shared hosting account.


strftime relies on the underlying C library to perform the formatting. The manual warns:

Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). [...] This means that [various things] will not work on Windows, some Linux distributions, and a few other operating systems.

Now, your format string is pretty darn elementary, so there's no real reason that there should be a failure here.

Honestly, your best bet might be using the PHP-native function date instead of strftime, as date doesn't rely on a C library call. The equivalent call would be:

echo date("d-m-y", '1304184490') . "\n";
0

精彩评论

暂无评论...
验证码 换一张
取 消