Monday, February 05, 2018
Quick and dirty fixes to allow Prestashop 1.7 to work in Debug mode on PHP 7.2
If you really need a quick and dirty fixes to allow Prestashop 1.7 to work in Debug mode on PHP 7.2, here it goes.
1) For the "Declaration of ControllerCore::setMedia() must be compatible with AdminControllerCore" error, check the admin controllers and modify the setMedia() to setMedia($isNewTheme = false)
Also the viewAccess() to viewAccess($disable = false)
2) For "Warning: count(): XXX must be an array or an object that implements Countable" add a empty() test on the array before the count.
Example in classes/Cart.php:
!empty($product_list) && count($product_list)
3) For "The each() function is deprecated.", replace "kv = each($mixed)" by
$kv = [$key, $mixed];
on vendor/prestashop/smarty/sysplugins/smarty_internal_compilebase.php
check the $kv['key'] before testing if the key is in the array
Like this:
$kv = [$key, $mixed];
// option flag?
if (isset($kv['key']) && in_array($kv['key'], $this->option_flags)) {
Hope it will help someone...
1) For the "Declaration of ControllerCore::setMedia() must be compatible with AdminControllerCore" error, check the admin controllers and modify the setMedia() to setMedia($isNewTheme = false)
Also the viewAccess() to viewAccess($disable = false)
2) For "Warning: count(): XXX must be an array or an object that implements Countable" add a empty() test on the array before the count.
Example in classes/Cart.php:
!empty($product_list) && count($product_list)
3) For "The each() function is deprecated.", replace "kv = each($mixed)" by
$kv = [$key, $mixed];
on vendor/prestashop/smarty/sysplugins/smarty_internal_compilebase.php
check the $kv['key'] before testing if the key is in the array
Like this:
$kv = [$key, $mixed];
// option flag?
if (isset($kv['key']) && in_array($kv['key'], $this->option_flags)) {
Hope it will help someone...