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
 

James

Well-known member
date_format

(PHP 5 >= 5.2.0)

Should work for any version greater than or equal to 5.2.
 

Alluidh

Well-known member
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
 

Pepelac

Well-known member
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.
 

Mike

XenForo developer
Staff member
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]);
 

Dodgeboard

Well-known member
FYI: This fix also corrected an Undefined Offset error with Coreys XForcast.php XenPorta module that displays weather forcasts.
 

EasyTarget

Well-known member
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