Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

PDFReports: cron task stops with Error: Object of class Piwik_Date could not be converted to int (piwik/core/Date.php on line 47) #1963

Closed
ziegenberg opened this Issue · 2 comments

2 participants

Daniel Ziegenberg Matthieu Aubry
Daniel Ziegenberg

If some PDFReports are declared the Cron Task stops with an Error.
In the class Piwik_PDFReports the function getScheduledTasks (piwik/plugins/PDFReports/PDFReports.php, 40) calls Piwik_Date::factory (piwik/core/Date.php, 45) on line 49 and this factory expects a string as the first argument, but Piwik_PDFReports gives it a Piwik_Date Object. Solution to this problem was to call getTimestamp() on that Object to meet the requirements of the factory function. Actually I didn't know if you expect a UTC time or the Time with the Timezone in, so either getTimestamp() oder getTimestampUTC() might be correct.

I changed:

    $baseDate = Piwik_Date::factory("1971-01-01");
    foreach($sites as &$site)
    {
        $offsetDate = Piwik_Date::factory($baseDate,  $site['timezone']);

        // Earlier means a negative timezone
        if ( $offsetDate->isEarlier($baseDate) )
        {

to:

    $baseDate = Piwik_Date::factory("1971-01-01");
    foreach($sites as &$site)
    {
        $offsetDate = Piwik_Date::factory($baseDate->getTimestamp(),  $site['timezone']);

        // Earlier means a negative timezone
        if ( $offsetDate->isEarlier($baseDate) )
        {

Keywords: nasty bug

Daniel Ziegenberg

Attachment:
backtrace.txt

Matthieu Aubry
Owner

This was fixed in Piwik 1.1.1

Daniel Ziegenberg ziegenberg added this to the Piwik 1.1.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.