Installed Sales Report v3.2.0 in zc155e. PHP version 5.6.31. I'm getting a PHP warning for a null array argument in in_array. Error message follows:
PHP Warning: in_array() expects parameter 2 to be array, null given in ...admin/includes/classes/sales_report.php on line 403
Existing out-of-the-box code is:
Code:
// check to see if product is unique in this timeframe
// add to 'diff_products' array if so
if (!in_array($pID, $this->timeframe[$id]['total']['diff_products'])) {
$this->timeframe[$id]['total']['diff_products'][] = $pID;
}
if (!in_array($pID, $this->timeframe[$id]['orders'][$oID]['diff_products'])) {
$this->timeframe[$id]['orders'][$oID]['diff_products'][] = $pID;
}
Should the code be something like this?
Code:
// check to see if product is unique in this timeframe
// add to 'diff_products' array if so
if (!in_array($pID, $this->timeframe[$id]['total']['diff_products'])) {
$this->timeframe[$id]['total']['diff_products'][] = $pID;
}
if (is_null($this->timeframe[$id]['orders'][$oID]['diff_products']) || !in_array($pID, $this->timeframe[$id]['orders'][$oID]['diff_products'])) {
$this->timeframe[$id]['orders'][$oID]['diff_products'][] = $pID;
}
Should a similar change be made to the if clause above the modified one?
Thanks!
Bookmarks