magmi-git
magmi-git copied to clipboard
Fix Division By Zero Warning (PHP7 compatibility)
In our installation magmi didn't work with PHP7 because of a divison by zero error. Calculation mod 0 is no longer supported by PHP7 (only a warning in PHP5). This change prevents this error.
I haven't tested if this fix is still needed after the latest refactoring of the product import engine.
this is not the best way to fix it. The root cause is a bug in the getProp
function which doesn't return default value in case of empty string.
around line 936 there is
$pstep = $this->getProp("GLOBAL", "step", 0.5);
And because "step" property is set to empty string and getProp
is not handling it correctly $pstep
is set to empty string, which then is converted to 0 in the next line
$rstep = ceil(($nitems * $pstep) / 100);
The correct solution for the issue is to fix getProp to return default value (0.5 in this case) when property is an empty string.
This is a fix for this issue:
https://github.com/dweeves/magmi-git/pull/516