Issue Bug Rejected

#103177Inconsistent behavior in MathUtility::canBeInterpretedAsInteger() for boolean values

Mathias Brodala 02/22/24, 11:52 updated 10/23/25, 14:05

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

Reviews 1

History 25

  1. Mathias Brodala changed Related to #103176 02/22/24, 11:53

  2. Gerrit Code Review pushed patch set 1 for main to change 85332 status New Under Review 07/23/24, 06:59

  3. Gerrit Code Review pushed patch set 2 for main to change 85332 07/24/24, 07:03

  4. Gerrit Code Review pushed patch set 3 for main to change 85332 07/24/24, 08:53

  5. Stefan Bürk commented and changed status Under Review Rejected 10/23/25, 14:05

    See comment from security team member @bfr https://review.typo3.org/c/Packages/TYPO3.CMS/+/85332/comments/465e0d52_49591f1a

    Rejecting/Closing this now.