You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since PHP8 the num parameter of the round() function no longer accepts internal objects which support numeric conversion. In our case we were passing an object of type SimpleXMLElement to round() which was not detected by the rules for PHP 8 comparability.
Given the following reproduction Scenario
The following code that used to pass SimpleXMLElement to round() was not detected as false in our case:
@hchonov This is not typically the type of check which PHPCompatibility is suitable to detect. PHPCompatibility does not have access to the runtime value of variable, so also doesn't have access to the type.
attributes() can return SimpleXMLElement or null, the width attribute (property) may or may not exist and can be of any XML supported types (can't be determined by examining the code).
In general, if a check would more often than not lead to a false positive, it is not suitable for PHPCompatibility and IMO, this is one of those cases.
Bug Description
Since PHP8 the
num
parameter of theround()
function no longer accepts internal objects which support numeric conversion. In our case we were passing an object of typeSimpleXMLElement
toround()
which was not detected by the rules for PHP 8 comparability.Given the following reproduction Scenario
The following code that used to pass
SimpleXMLElement
toround()
was not detected as false in our case:which was then throwing an Error:
TypeError: round(): Argument #1 ($num) must be of type int|float,
This could've been detected though since the
::attributes()
returns an SimpleXMLElement object with attributes that are also of the same type.The text was updated successfully, but these errors were encountered: