Bug #103177
openInconsistent behavior in MathUtility::canBeInterpretedAsInteger() for boolean values
0%
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
Updated by Mathias Brodala 9 months ago
- Related to Task #103176: Test MathUtility::canBeInterpretedAsInteger() with bool added
Updated by Gerrit Code Review 4 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85332
Updated by Gerrit Code Review 4 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85332
Updated by Gerrit Code Review 4 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85332