@robocoder opened this Issue on May 5th 2010 Contributor

php 5.1.6 user reported getting a notice:

Notice: Object of class Piwik_Date to string conversion in /var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Statement/Pdo.php on line 228

Backtrace -->
<a href='/0'>#0</a> Piwik_ErrorHandler(8, Object of class Piwik_Date to string conversion, /var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Statement/Pdo.php, 228, Array ([params] => Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)))
<a href='/1'>#1</a> PDOStatement->execute(Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Statement/Pdo.php:228]
<a href='/2'>#2</a> Zend_Db_Statement_Pdo->_execute(Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Statement.php:300]
<a href='/3'>#3</a> Zend_Db_Statement->execute(Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Adapter/Abstract.php:468]
<a href='/4'>#4</a> Zend_Db_Adapter_Abstract->query(INSERT IGNORE INTO piwik_archive_numeric_2010_05 (idarchive, idsite, date1, date2, period, ts_archived, name, value)
VALUES (?,?,?,?,?,?,?,?), Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/libs/Zend/Db/Adapter/Pdo/Abstract.php:238]
<a href='/5'>#5</a> Zend_Db_Adapter_Pdo_Abstract->query(INSERT IGNORE INTO piwik_archive_numeric_2010_05 (idarchive, idsite, date1, date2, period, ts_archived, name, value)
VALUES (?,?,?,?,?,?,?,?), Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/PluginsFunctions/Sql.php:41]
<a href='/6'>#6</a> Piwik_Sql::query(INSERT IGNORE INTO piwik_archive_numeric_2010_05 (idarchive, idsite, date1, date2, period, ts_archived, name, value)
VALUES (?,?,?,?,?,?,?,?), Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/PluginsFunctions/Sql.php:86]
<a href='/7'>#7</a> Piwik_Query(INSERT IGNORE INTO piwik_archive_numeric_2010_05 (idarchive, idsite, date1, date2, period, ts_archived, name, value)
VALUES (?,?,?,?,?,?,?,?), Array ([0] => 2,[1] => 1,[2] => Piwik_Date Object ([] => 1273017600,[] => UTC),[3] => Piwik_Date Object ([] => 1273017600,[] => UTC),[4] => 1,[5] => 2010-05-05 20:41:07,[6] => done,[7] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ArchiveProcessing.php:634]
<a href='/8'>#8</a> Piwik_ArchiveProcessing->insertRecord(Piwik_ArchiveProcessing_Record_Numeric Object ([name] => done,[value] => 2)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ArchiveProcessing.php:567]
<a href='/9'>#9</a> Piwik_ArchiveProcessing->insertNumericRecord(done, 2) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ArchiveProcessing.php:428]
<a href='/10'>#10</a> Piwik_ArchiveProcessing->initCompute() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ArchiveProcessing.php:409]
<a href='/11'>#11</a> Piwik_ArchiveProcessing->launchArchiving() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/Archive/Single.php:185]
<a href='/12'>#12</a> Piwik_Archive_Single->prepareArchive() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/Archive.php:170]
<a href='/13'>#13</a> Piwik_Archive::build(1, day, 2010-05-05) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/plugins/VisitorInterest/API.php:33]
<a href='/14'>#14</a> Piwik_VisitorInterest_API->getDataTable(VisitorInterest_timeGap, 1, day, 2010-05-05) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/plugins/VisitorInterest/API.php:43]
<a href='/15'>#15</a> Piwik_VisitorInterest_API->getNumberOfVisitsPerVisitDuration(1, day, 2010-05-05)
<a href='/16'>#16</a> call_user_func_array(Array ([0] => Piwik_VisitorInterest_API Object (),[1] => getNumberOfVisitsPerVisitDuration), Array ([0] => 1,[1] => day,[2] => 2010-05-05)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/API/Proxy.php:147]
<a href='/17'>#17</a> Piwik_API_Proxy->call(Piwik_VisitorInterest_API, getNumberOfVisitsPerVisitDuration, Array ([method] => VisitorInterest.getNumberOfVisitsPerVisitDuration,[format] => original,[filter_limit] => 30,[filter_sort_column] => label,[filter_sort_order] => asc,[module] => VisitorInterest,[action] => getNumberOfVisitsPerVisitDuration,[idSite] => 1,[period] => day,[date] => 2010-05-05)) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/API/Request.php:113]
<a href='/18'>#18</a> Piwik_API_Request->process() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ViewDataTable.php:341]
<a href='/19'>#19</a> Piwik_ViewDataTable->loadDataTableFromAPI() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/ViewDataTable/Cloud.php:66]
<a href='/20'>#20</a> Piwik_ViewDataTable_Cloud->main() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/Controller.php:153]
<a href='/21'>#21</a> Piwik_Controller->renderView(Piwik_ViewDataTable_Cloud Object ([] => ,[] => CoreHome/templates/cloud.tpl,[] => 1,[] => Array ([filter_sort_column] => label,[filter_sort_order] => asc,[filter_limit] => 30),[] => Array ([show_goals] => ,[show_search] => ,[show_table] => 1,[show_table_all_columns] => ,[show_all_views_icons] => 1,[show_export_as_image_icon] => ,[show_exclude_low_population] => ,[show_offset_information] => ,[show_footer] => 1,[show_footer_icons] => 1,[apiMethodToRequestDataTable] => VisitorInterest.getNumberOfVisitsPerVisitDuration,[uniqueId] => VisitorInterestgetNumberOfVisitsPerVisitDuration),[] => 0,[] => ,[] => getNumberOfVisitsPerVisitDuration,[] => VisitorInterest,[] => ,[] => VisitorInterest.getNumberOfVisitsPerVisitDuration,[] => ,[] => Array ([label] => Visit duration,[nb_visits] => Visits,[nb_actions] => Actions,[max_actions] => Maximum actions in one visit,[sum_visit_length] => Total time spent by visitors (in seconds),[nb_uniq_visitors] => Unique visitors,[nb_actions_per_visit] => Actions per Visit,[avg_time_on_site] => Avg. Time on Website,[bounce_rate] => Bounce Rate,[revenue_per_visit] => Value per Visit,[goals_conversion_rate] => Visits with Conversions),[] => Array ([0] => label,[1] => nb_visits),[isDataAvailable] => 1), ) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/plugins/VisitorInterest/Controller.php:40]
<a href='/22'>#22</a> Piwik_VisitorInterest_Controller->getNumberOfVisitsPerVisitDuration()
<a href='/23'>#23</a> call_user_func_array(Array ([0] => Piwik_VisitorInterest_Controller Object ([] => VisitorInterest,[] => 2010-05-05,[] => Piwik_Date Object ([] => 1273017600,[] => UTC),[] => 1,[] => Piwik_Site Object ([] => 1),[] => Array ([label] => General_ColumnLabel,[nb_visits] => General_ColumnNbVisits,[nb_actions] => General_ColumnNbActions,[max_actions] => General_ColumnMaxActions,[sum_visit_length] => General_ColumnSumVisitLength,[nb_uniq_visitors] => General_ColumnNbUniqVisitors,[nb_actions_per_visit] => General_ColumnActionsPerVisit,[avg_time_on_site] => General_ColumnAvgTimeOnSite,[bounce_rate] => General_ColumnBounceRate,[revenue_per_visit] => General_ColumnValuePerVisit,[goals_conversion_rate] => General_ColumnVisitsWithConversions)),[1] => getNumberOfVisitsPerVisitDuration), Array ()) called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/core/FrontController.php:129]
<a href='/24'>#24</a> Piwik_FrontController->dispatch() called at [/var/www/vhosts/mydomainname.com/httpdocs/livestats/index.php:59]

It's not apparent from the manual ( http://us3.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring ), but I think we need to explicitly cast Piwik_Date objects to string, in order to suppress the notice.

@robocoder commented on May 6th 2010 Contributor

dupes #1328

This Issue was closed on May 6th 2010
Powered by GitHub Issue Mirror