Opened 3 years ago

Closed 3 years ago

#1783 closed Bug (fixed)

PDFReports: Send Report Now not working, Error: Object of class Piwik_Date could not be converted to int

Reported by: sma Owned by:
Priority: normal Milestone: Piwik 1.1
Component: Core Keywords:
Cc: Sensitive: no

Description

HI, there:

The mail function on the server seems fine, if I do recover password I can get the email. However, the Email Report is not working, everytime I tried "Send Report Now", I got the following error in application log:

Piwik_ErrorHandler(8, Object of class Piwik_Date could not be converted to int, /var/www/html/core/Date.php, 59, Array ([dateString] =&gt; Piwik_Date Object ([] =&gt; 1287591505,[] =&gt; UTC),[timezone] =&gt; )) called at var/www/html/core/Date.php:59<br />

any idea what is causing this and how can I fix it?
thank you very much!
sincerely
Steve

Change History (6)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Milestone set to 1.1 - Piwik 1.1
  • Summary changed from Email Reports are not working, Error: Object of class Piwik_Date could not be converted to int to PDFReports: Send Report Now not working, Error: Object of class Piwik_Date could not be converted to int

comment:2 Changed 3 years ago by vipsoft (robocoder)

I couldn't reproduce the problem on trunk (i.e., no error).

On 1.0, using FF3.6, I can't get the 'Send Report Now' button to even trigger.

Steve: can you email us a stack trace? (if you opt to attach it here, you should filter the contents)

comment:3 Changed 3 years ago by sma

here is the trace in error log:

<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'><b>Notice:</b> <i>Object of class Piwik_Date could not be converted to int</i> in <b>/var/www/html/core/Date.php</b> on line <b>59</b>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt">#0  Piwik_ErrorHandler(8, Object of class Piwik_Date could not be converted to int, /var/www/html/core/Date.php, 59, Array ([dateString] =&gt; Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC),[timezone] =&gt; )) called at [/var/www/html/core/Date.php:59]<br />
#1  Piwik_Date::factory(Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC)) called at [/var/www/html/plugins/PDFReports/API.php:245]<br />
#2  Piwik_PDFReports_API-&gt;generateReport(6, Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC), 3, 2) called at [/var/www/html/plugins/PDFReports/API.php:315]<br />
#3  Piwik_PDFReports_API-&gt;sendEmailReport(6, 3)<br />
#4  call_user_func_array(Array ([0] =&gt; Piwik_PDFReports_API Object ([] =&gt; Array ()),[1] =&gt; sendEmailReport), Array ([0] =&gt; 6,[1] =&gt; 3)) called at [/var/www/html/core/API/Proxy.php:151]<br />
#5  Piwik_API_Proxy-&gt;call(Piwik_PDFReports_API, sendEmailReport, Array ([token_auth] =&gt; XXXXXXXXXX,[idSite] =&gt; 3,[module] =&gt; API,[method] =&gt; PDFReports.sendEmailReport,[format] =&gt; json,[idReport] =&gt; 6,[filter_limit] =&gt; 50)) called at [/var/www/html/core/API/Request.php:117]<br />
#6  Piwik_API_Request-&gt;process() called at [/var/www/html/plugins/API/Controller.php:27]<br />
#7  Piwik_API_Controller-&gt;index()<br />
#8  call_user_func_array(Array ([0] =&gt; Piwik_API_Controller Object ([] =&gt; API,[] =&gt; ,[] =&gt; ,[] =&gt; 3,[] =&gt; ),[1] =&gt; index), Array ()) called at [/var/www/html/core/FrontController.php:126]<br />
#9  Piwik_FrontController-&gt;dispatch() called at [/var/www/html/index.php:60]<br />
</div><br /><br />
</pre></div><br />

comment:4 Changed 3 years ago by vipsoft (robocoder)

I don't know why line 59 of Date.php is triggering an error, but can you try the following change?

In plugins/PDFReports/API.php's sendEmailReport() function, change:

Piwik_PDFReports_API::getInstance()->generateReport(
    $idReport,
    Piwik_Date::now()->subPeriod(1, $report['period']),
    $idSite,
    $outputType = Piwik_PDFReports_API::OUTPUT_PDF_SAVE_ON_DISK
);

to:

Piwik_PDFReports_API::getInstance()->generateReport(
    $idReport,
    Piwik_Date::now()->subPeriod(1, $report['period'])->toString(),
    $idSite,
    $outputType = Piwik_PDFReports_API::OUTPUT_PDF_SAVE_ON_DISK
);

comment:5 Changed 3 years ago by sma

yes! that fixed it. The PDFReports works fine after applying that change.
thank you very much!

comment:6 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [3273]) fixes #1783

Note: See TracTickets for help on using tickets.