Recently viewed products

PHP Warning Parameter must be an array or an object - Recently viewed products

PHP Warning Parameter must be an array or an object

by Valquiria » Fri Jun 04, 2021 9:51 pm

Hola Rainer, como estas? Espero que todo bien!!

I'm having another PHP error which I can't fix in the recently viewed addon.

PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/mysite/public_html/catalog/recently_viewed.php on line 134

Line 134 is like that:

if (count ($listing_sql) == 0) {

Any Clue how to fix it?

Que tengas excelente fin de semana.

Saludos
Valqui
Valquiria
Posts: 8
Joined: Tue Apr 27, 2021 1:08 am
Contact:

Re: PHP Warning Parameter must be an array or an object

by Valquiria » Fri Jun 04, 2021 10:06 pm

another question, I saw that each() function was discontinued in PHP 7.2+ on line 62 it appears:

while (list($key, $value) = each($define_list)) {

Is the correct replacement to change it to foreach function would be ?

foreach($define_list as $key => $value) {

even though the each () function was discontinued I don't see any errors arising, is that expected?

Muchas gracias

Valqui
Valquiria
Posts: 8
Joined: Tue Apr 27, 2021 1:08 am
Contact:

Re: PHP Warning Parameter must be an array or an object

by raiwa » Sat Jun 05, 2021 5:15 am

Please update to the latest version for your store version. It should have these errors fixed.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Contact:

Re: PHP Warning Parameter must be an array or an object

by Valquiria » Sat Jun 05, 2021 8:07 am

Thank you very much Rainer,
There was no vision with corrections for the version of my store, but looking at newer versions I found the changes you have made. Thank you very much, very good weekend.
Valquiria
Posts: 8
Joined: Tue Apr 27, 2021 1:08 am
Contact: