Quote Originally Posted by jimmie View Post
how do i fix this warning
[28-Mar-2024 21:32:23 UTC] Request URI: /Returns, IP address: 44.222.104.49
#1 products_with_attributes_stock->catalogCustomID() called at [/var/www/clients/client1/web3/web/includes/classes/observers/class.pwas_customid.php:32]
#2 pwas_customid->updateNotifyHeaderEndAccountHistoryInfo() called at [/var/www/clients/client1/web3/web/includes/classes/class.base.php:103]
#3 base->notify() called at [/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php:74]
#4 require(/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php) called at [/var/www/clients/client1/web3/web/index.php:36]
--> PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client1/web3/web/includes/classes/observers/class.products_with_attributes_stock.php on line 1612.
and here is line 1612 from file
Code:
foreach ($productArray as $i => &$productsI) {
      $customid[$i] = '';
Could you post the contents of includes/modules/pages/returns_request/header_php.php?

It appears that the code is "misusing" or not properly initiating the process to fully support reuse of the notifier associated with account history information...

While, the code may be "the same" as a possibility, perhaps the avenue to arrive there is not equivalent. When looking at the code for includes/modules/pages/account_history_info/header_php.php, there are a number of "early out" operations to ensure that processing continues successfully and as expected for arriving on that page.

Reviewing the order class initiation (__construct) at least in ZC 1.5.8, the result is at least an array of product even if that is an empty array. Provided the product member is an array, there should be no issue with attempting execution of that foreach loop. It just wouldn't do any action if it was empty. That said, I see in the order class initiation there are also two additional notifiers either of which may have been called and modified the data being returned... That could be an indicator of the situation's cause.

Based on the warning message, it appears that $order is initiated (not null), otherwise there would be an issue within observer class.pwas_customid.php at line 32 with attempting to access a null variable or accessing a member that does not exist $order->products. These issues do not arise and instead $order->products appears to not be an array, though the warning doesn't identify what type of variable it is (null, false, or something else). There may also be other information in that particular log that points to one or more of the above issues, but I have to assume that the entire log was provided.