Fixed Error after clicking on Daily Statistics link in ACP

Pepelac

Well-known member
I've got this.

Fatal error: Call to a member function format() on a non-object in /sskipped/library/XenForo/Helper/Date.php on line 37
 
The error occurs not only there, you'll be able to get it on a click on "Attachment Browser" and other parts too

PHP Version 5.2.6-1+lenny10
 
What version of PHP are you running?
I've tested it on my local machine on MAMP server with PHP 5.2.17 and on the production server with PHP 5.2.6-1+lenny9. In both cases I've got this error.

On PHP 5.3.6 there is no such error.
 
Fixed. library/XenForo/Helper/Date.php, change:
Code:
$presets[$date->modify($presetData[0])->format('Y-m-d')] = new XenForo_Phrase($presetData[1]);
to:
Code:
$date->modify($presetData[0]);
$presets[$date->format('Y-m-d')] = new XenForo_Phrase($presetData[1]);
 
FYI: This fix also corrected an Undefined Offset error with Coreys XForcast.php XenPorta module that displays weather forcasts.
 
For some reason although you should be able to chain function calls, php sometimes has a problem when chaining inside an array parameter. In php 5.3 the bug is fixed.
 
Top Bottom