Page 1 of 1
Problem with TWIG after migrate from XAMPP
Posted: Wed Oct 24, 2018 12:00 am
by DesignCart
Hi
After migrate shop from XAMPP on serwer I see php warning:
Code: Select all
Warning: count(): Parameter must be an array or an object that implements Countable in .../system/library/template/Twig/Extension/Core.php on line 1266
I checked all folder cache and deleted all files. I cleaned cache in panel admin. I refresh modyfication in panel admin and nothing helped.
Somebody have any idea?

Re: Countable PHP 7.2x Problem with TWIG after migrate from XAMPP ?
Posted: Wed Oct 24, 2018 7:40 am
by IP_CAM
Countable PHP 7.2x Problem
You seem to run a PHP v.7.2x Environment, so, switch back to a lower PHP 7.x Version,
or then, get this Line #1266 fixed by a Coder:
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
This might have a similar meaning, as mentioned in the posting linked below, as I assume, it should
first check for 'whatever valid', then count the 'pieces', not in reverse ...

(but I am not a Coder...)
viewtopic.php?f=19&t=207673&p=737973#p737973
viewtopic.php?f=179&t=205523&p=728536#p728589
Just an idea, good Luck!
Ernie
Re: Problem with TWIG after migrate from XAMPP
Posted: Wed Oct 24, 2018 3:37 pm
by DesignCart
@IP_CAM thank You for answer and help. Your idea work fine and fix my problem.
I changed php version to 5.6 from 7.2
Re: Problem with TWIG after migrate from XAMPP
Posted: Thu Aug 08, 2019 5:35 am
by assyk
Gratz of IP_Cam and changing at row #1266:
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
with
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : ($thing instanceof Countable ? count($thing):0);
my error message disapeared
Re: Problem with TWIG after migrate from XAMPP
Posted: Mon Aug 29, 2022 4:19 am
by kuochinwu
assyk wrote: ↑Thu Aug 08, 2019 5:35 am
Gratz of IP_Cam and changing at row #1266:
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
with
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : ($thing instanceof Countable ? count($thing):0);
my error message disapeared
Hello, I applied the code and it worked and no more error in logs; however, the language and currency drop-down selections on the top header got disappeared after this patch. any other help?
Re: Problem with TWIG after migrate from XAMPP
Posted: Mon Aug 29, 2022 6:36 am
by straightlight
kuochinwu wrote: ↑Mon Aug 29, 2022 4:19 am
assyk wrote: ↑Thu Aug 08, 2019 5:35 am
Gratz of IP_Cam and changing at row #1266:
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : count($thing);
with
Code: Select all
return is_scalar($thing) ? mb_strlen($thing, $env->getCharset()) : ($thing instanceof Countable ? count($thing):0);
my error message disapeared
Hello, I applied the code and it worked and no more error in logs; however, the language and currency drop-down selections on the top header got disappeared after this patch. any other help?
Recently, the currency selection issue has been fixed in the opencart-3 repository. See if you are now able to select currencies and notice the changes with the amounts accordingly:
https://www.github.com/opencart/opencart-3 .