@anonymous-piwik-user opened this Issue on October 27th 2010

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 ([=> Piwik_Date Object ( => 1287591505,[=> UTC),timezone => )) 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

@robocoder commented on October 28th 2010 Contributor

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)

@anonymous-piwik-user commented on October 28th 2010

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"><a href='/0'>#0</a>  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 />
<a href='/1'>#1</a>  Piwik_Date::factory(Piwik_Date Object ([] =&gt; 1287683565,[] =&gt; UTC)) called at [/var/www/html/plugins/PDFReports/API.php:245]<br />
<a href='/2'>#2</a>  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 />
<a href='/3'>#3</a>  Piwik_PDFReports_API-&gt;sendEmailReport(6, 3)<br />
<a href='/4'>#4</a>  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 />
<a href='/5'>#5</a>  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 />
<a href='/6'>#6</a>  Piwik_API_Request-&gt;process() called at [/var/www/html/plugins/API/Controller.php:27]<br />
<a href='/7'>#7</a>  Piwik_API_Controller-&gt;index()<br />
<a href='/8'>#8</a>  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 />
<a href='/9'>#9</a>  Piwik_FrontController-&gt;dispatch() called at [/var/www/html/index.php:60]<br />
</div><br /><br />
</pre></div><br />
@robocoder commented on October 28th 2010 Contributor

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
);
@anonymous-piwik-user commented on October 29th 2010

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

@robocoder commented on October 29th 2010 Contributor

(In [3273]) fixes #1783

This Issue was closed on October 29th 2010
Powered by GitHub Issue Mirror