Osclass
Osclass copied to clipboard
Unexpected error message "Price must be positive number." when editing an item with price greater than 2147.00
Osclass 5.1.2 Unable to edit an item when price greater than 2147.00 ("Price must be positive number." error)
In some platforms (32 bits), also where PHP_INT_MAX=2147483647
,
the sign test (int)$aItem['price'] < 0
may produce unexpected result if item price greater than 2147.00
and also ItemActions->validateCommonInput()
method will failed
(since price is multiplied by 1,000,000 before validation and store in database)
To Reproduce Steps to reproduce the behavior:
- Edit an item
- Set a price greater than 2147.00
- Save -> save failed with error: "Price must be positive number."
Expected behavior Save successfull
Bug Fix
Replace line 456 in ItemActions.php:
$flash_error .= (($aItem['price'] !== null && (int)$aItem['price'] < 0)
by:
$flash_error .= (($aItem['price'] !== null && (float)$aItem['price'] < 0)
Regards