PeeHaa / OpCacheGUI

GUI for PHP's OpCache
1.46k stars 170 forks source link

Use setTimestamp to prevent DateTimer parse exceptions #14

Closed OndraM closed 10 years ago

OndraM commented 10 years ago

On PHP 5.5.9 exception is thrown:

Fatal error: Uncaught exception 'Exception' with message 'DateTime::construct(): Failed to parse time string (@) at position 0 (@): Unexpected character' in /usr/share/webapps/OpCacheGUI/src/OpCacheGUI/OpCache/Status.php:123 Stack trace: #0 /usr/share/webapps/OpCacheGUI/src/OpCacheGUI/OpCache/Status.php(123): DateTime->construct('@') #1 /usr/share/webapps/OpCacheGUI/template/status.phtml(39): OpCacheGUI\OpCache\Status->getStatsInfo() #2 /usr/share/webapps/OpCacheGUI/bootstrap.php(95): require('/usr/share/weba...') #3 /usr/share/webapps/OpCacheGUI/public/index.php(3): require('/usr/share/weba...') #4 {main} thrown in /usr/share/webapps/OpCacheGUI/src/OpCacheGUI/OpCache/Status.php on line 123

This PR fixes at and makes the DateTime being created from timestamp in a PHP 5.3+ way.

PeeHaa commented 10 years ago

I'm fairly certain the issue was not the way the instance was created, but rather the fact that the timestamp was not set.

There have been several iterations at that part of the code and I am pretty sure this issue is fixed now.

If you are still having this issue let me know and I will investigate more.