Actions
Bug #103177
openInconsistent behavior in MathUtility::canBeInterpretedAsInteger() for boolean values
Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Code Cleanup
Target version:
-
Start date:
2024-02-22
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
The behavior of MathUtility::canBeInterpretedAsInteger()
is inconsistent:
var_dump(MathUtility::canBeInterpretedAsInteger(true)); // true var_dump(MathUtility::canBeInterpretedAsInteger(false)); // false
Assuming that the common true
= 1
, false
= 0
logic applies, the behavior should be fixed to accept both boolean values. Both can be coerced into integers and thus interpreted a such:
var_dump(MathUtility::canBeInterpretedAsInteger(true)); // true var_dump(MathUtility::canBeInterpretedAsInteger(false)); // true
Alternatively both boolean values should be rejected for consistency:
var_dump(MathUtility::canBeInterpretedAsInteger(true)); // false var_dump(MathUtility::canBeInterpretedAsInteger(false)); // false
Actions