Project

General

Profile

Actions

Bug #85741

closed

Bugfix for MathExpressionNode.php

Added by Daxboeck no-lastname-given almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Start date:
2018-08-03
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

    /**
     * @param integer|float $left
     * @param string $operator
     * @param integer|float $right
     * @return integer|float
     */
    protected static function evaluateOperation($left, $operator, $right)
    {
        if ($operator === '%') {
            return (float)$left % (float)$right;
        } elseif ($operator === '-') {
            return (float)$left - (float)$right;
        } elseif ($operator === '+') {
            return (float)$left + (float)$right;
        } elseif ($operator === '*') {
            return (float)$left * (float)$right;
        } elseif ($operator === '/') {
            return (integer) $right !== 0 ? (float)$left / (float)$right : 0;
        } elseif ($operator === '^') {
            return pow((float)$left, (float)$right);
        }
        return 0;
    }

Related issues 2 (0 open2 closed)

Is duplicate of TYPO3 Core - Bug #85604: PHP warning when doing math in FluidClosed2018-07-20

Actions
Has duplicate TYPO3 Core - Bug #87978: Missing declarations in MathExpressionNode.phpClosed2019-03-22

Actions
Actions

Also available in: Atom PDF