Fixed Casting Issue with PHP 7

silence

Well-known member
Affected version
1.5.15a
In the class at library/XenForo/DataWriter/Option.php, at line 327 this seems to prevent installing add-ons with numeric options:

Code:
            case 'numeric': $optionValue = strval($optionValue) + 0; break;
 
This is fixed for the next release, thanks. You can fix this by replacing this line with:
Code:
case 'numeric': $optionValue = strval(floatval($optionValue)) + 0; break;
However, an easier fix is likely to be to make reasonable assurances that any numeric option you create has a reasonable numeric value. I'm going to take a guess that the default option for this is a blank string (rather than 0).

(Alternatively, it could be someone entering a non-numeric string in which case the line will prevent the error, but equally, it might not be outputting what they expect, such as if they enter a "," for a decimal separator.)

(Note that there is another instance like this in the same file. The fix is similar though not identical.)
 
Back
Top Bottom