Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 Jan 5, 2011 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@ziegenberg
Copy link
Contributor

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

@ziegenberg
Copy link
Contributor Author

Attachment:
backtrace.txt

@mattab
Copy link
Member

mattab commented Jan 5, 2011

This was fixed in Piwik 1.1.1

@ziegenberg ziegenberg added this to the Piwik 1.1.1 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants