I am actually facing a big problem with several websites (actually 3) based on Prestashop. The problem is that PHP or Prestashop randomly rounds prices to the nearest integer and it is not systematic.
Most of the time, it works perfectly, as it should, but sometimes (it can takes weeks or months between two problems), a price is rounded. My round mode option is correctly set to display two decimals.
The problem can occur when editing a product price in the back-office or when the customer is at the checkout step.
I tried to reproduce the problem, so I created a basic test: I retrieve a cart information and I display its price. I refreshed the page many times and I saw the price rounded a few times only. The most intriguous thing is that neither the context nor the code have changed between the beginning and the ending of the test.
I searched for help on Google and no one seemed to have this problem...
Did someone encounter this problem? Do you think it is a PHP issue or a Prestashop one? Thanks in advance for your help.
Here is the code of the round function Prestashop is using:
round($value, 2, PHP_ROUND_HALF_UP);
For information, the version of PHP 5.4.39.