You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BugFor errors / faults / flaws / inconsistencies etc.MajorIndicates the severity or impact or benefit of an issue is much higher than normal but not critical.
While testing the API with idSite=all on my development instance I noticed that calling any API function with idSite=all results in an error when there is only one site.
Specifically, I get the following Error:
```
Recoverable Error: Argument 1 passed to Piwik_Date::isEarlier() must be an instance of Piwik_Date, null given, called in /Users/patrick/projects/sandwichboard/stats/modules/Archive/Single.php on line 143 and defined in /Users/patrick/projects/sandwichboard/stats/modules/Date.php on line 107
Backtrace —>
Piwik_ErrorHandler(4096, Argument 1 passed to Piwik_Date::isEarlier() must be an instance of Piwik_Date, null given, called in /Users/patrick/projects/sandwichboard/stats/modules/Archive/Single.php on line 143 and defined, /Users/patrick/projects/sandwichboard/stats/modules/Date.php, 107, Array ()) called at [/Users/patrick/projects/sandwichboard/stats/modules/Date.php:107]
Piwik_Date→isEarlier() called at [/Users/patrick/projects/sandwichboard/stats/modules/Archive/Single.php:143]
Piwik_Archive_Single→prepareArchive() called at [/Users/patrick/projects/sandwichboard/stats/modules/Archive/Array/IndexedByDate.php:20]
Piwik_Archive_Array_IndexedByDate→__construct(Piwik_Site Object ([] => all), day, last30) called at [/Users/patrick/projects/sandwichboard/stats/modules/Archive.php:106]
Piwik_Archive::build(all, day, last30) called at [/Users/patrick/projects/sandwichboard/stats/plugins/VisitsSummary/API.php:49]
Piwik_VisitsSummary_API→getNumeric(all, day, last30, nb_visits) called at [/Users/patrick/projects/sandwichboard/stats/plugins/VisitsSummary/API.php:56]
I found the problem and added a patch to fix the issue. Piwik_Archive→build assumed that if there weren’t multiple sites in he $sites array then $idSite was a numeric id of a site.
However, $idSite could also have been “all” and there could only have been one site.
I fixed the issue by replacing references to $idSite with references to the first element of the $sites array.
This was fixed with [and 585(584]). That is a better fix than the patch I submitted, because it returns an IndexedBySite Archive Array with one element, which is the behavior you would expect.
BugFor errors / faults / flaws / inconsistencies etc.MajorIndicates the severity or impact or benefit of an issue is much higher than normal but not critical.
While testing the API with idSite=all on my development instance I noticed that calling any API function with idSite=all results in an error when there is only one site.
Specifically, I get the following Error:
```
Recoverable Error: Argument 1 passed to Piwik_Date::isEarlier() must be an instance of Piwik_Date, null given, called in /Users/patrick/projects/sandwichboard/stats/modules/Archive/Single.php on line 143 and defined in /Users/patrick/projects/sandwichboard/stats/modules/Date.php on line 107
Backtrace —>
Fatal error: Call to a member function getTimestamp() on a non-object in /Users/patrick/projects/sandwichboard/stats/modules/Date.php on line 109
```
Adding another site makes the issue go away. Removing the site makes the error come back.
I was testing with the following API call, but it occurs for others as well
``
``````
The text was updated successfully, but these errors were encountered: