Prestashop: 1.7.4.3 Error with shopping cart

Created on 18 Oct 2018  路  10Comments  路  Source: PrestaShop/PrestaShop

Prestashop 1.7.4.3.
PHP 7.2

1/1)聽ContextErrorExceptionWarning: count(): Parameter must be an array or an object that implements Countable

in聽Cart.php聽line 61
at聽Cart->getPackageShippingCost(279,聽true,聽object(Country),聽null, 9)in聽Carrier.php聽line 748
at聽CarrierCore::getCarriersForOrder(9,聽array('3'),聽object(Cart),聽array())in聽Carrier.php聽line 1540
at聽CarrierCore::getAvailableCarrierList(object(Product), 0, '37135', 1,聽object(Cart))in聽Cart.php聽line 2321
at聽CartCore->getPackageList(false)in聽Cart.php聽line 2532
at聽CartCore->getDeliveryOptionList(null)in聽Cart.php聽line 3081
at聽CartCore->getDeliveryOption(null,聽false,聽false)in聽Cart.php聽line 3150
at聽CartCore->getTotalShippingCost(null,聽true)in聽Fees.php聽line 82
at聽Fees->processCalculation(object(Cart),聽object(CartRowCollection), '2',聽null)in聽Calculator.php聽line 271
at聽Calculator->calculateFees('2')in聽Calculator.php聽line 124
at聽Calculator->processCalculation('2')in聽Cart.php聽line 1901
at聽CartCore->getOrderTotal(false)in聽CartPresenter.php聽line 286
at聽CartPresenter->present(object(Cart),聽true)in聽CartController.php聽line 102
at聽CartControllerCore->initContent()in聽Controller.php聽line 255
at聽ControllerCore->run()in聽Dispatcher.php聽line 428
at聽DispatcherCore->dispatch()in聽index.php聽line 28

2018-10-18_16h27_31

1.7.4.3 Bug Fixed Shopping carts

All 10 comments

Hi @Peter4661,

Could you please add steps to reproduce the issue in a new comment.
Thanks!

Customer complaint he did not recieve order confirmation.

We tried to reproduce it by placing order ourselves.

In last payment step, selecting payment method "bank transfer", 500 error when confirming order.

With debug, on putting product in shopping cart, did get result as shown above.

Order has been processed in backoffice. No order confirmation revieved.

Issue solved after installing php-intl extension!

Backoffice alos now sends order messages correct!

Hi @Peter4661,

Thanks for your feedback.
Since it is fixed.
I close the issue, feel free to open a new one when needed.
Thanks!

PHP 7.2

ContextErrorExceptionWarning: count(): Parameter must be an array or an object that implements Countable

in聽Cart.php聽line 61
at聽Cart->getPackageShippingCost(62,聽true,聽object(Country),聽null, 9)in聽Carrier.php聽line 758

Still this bug on PS 1.7.6.0

@matteolavaggi, php-intl extension is installed on your server?

Thanks!

Yes, i've found the problem, is related to the count() function modification on php7.2 that now retunr an e warning.

THe problem is related to this module , developer has not yet fixed it (crazy)

Free Delivery Pro

BTW because prestashop is full of third parts module , why there isn't a check against php compatibility of them? OR better there is no way to implement a better handling of the error send back from count() function in dev mode? thanks

For now i've fix the dev capability changing the function to @count , and ask developer to do therir job.

elseif (@count($product_list)) {

@matteolavaggi, As it's not a module provided by Prestashop, we can't do anything with this.
You should contact the module author via your addons.prestashop.com account, they are the only ones to help you with it.
Thanks!

BTW because prestashop is full of third parts module , why there isn't a check against php compatibility of them? OR better there is no way to implement a better handling of the error send back from count() function in dev mode? thanks

Unfortunately there are no reliable ways to be able to say "this module is php7.2 compatible". There are lot of tools that can find php7.2 errors in a php code, but no tool can confirm there is absolutely zero issues in it. This is the responsibility of the module developer to handle different php versions, or to warn users what versions are not compatible.

BTW this module is really late 馃槃 php 7.1 will be End Of Life in 2020 so he better hurry to be php7.2 compliant and php7.3 compliant

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wikao2 picture wikao2  路  3Comments

matks picture matks  路  3Comments

marionf picture marionf  路  3Comments

khouloudbelguith picture khouloudbelguith  路  3Comments

rGaillard picture rGaillard  路  3Comments