Project

General

Profile

Actions

Bug #103177

open

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

Added by Mathias Brodala 9 months ago. Updated 4 months ago.

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

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #103176: Test MathUtility::canBeInterpretedAsInteger() with boolClosed2024-02-22

Actions
Actions

Also available in: Atom PDF