Project

General

Profile

Actions

Bug #85741

closed

Bugfix for MathExpressionNode.php

Added by Daxboeck no-lastname-given over 6 years ago. Updated about 6 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 #1

Updated by Georg Ringer over 6 years ago

  • Description updated (diff)
  • Status changed from New to Needs Feedback

please add some more information: how to reproduce? what do you expect, what is the current outcome?

Actions #2

Updated by Daxboeck no-lastname-given over 6 years ago

I had to add the type declarations (float) to avoid warnings when I used Math in my Fluid templates.

e.g. {dimensions.height*1.5} did cause a PHP warning in that file (MathExpressionNode.php), which the above code replacement fixes.

Actions #3

Updated by Susanne Moog about 6 years ago

  • Target version changed from 8.7.19 to Candidate for patchlevel
Actions #4

Updated by Wouter Wolters about 6 years ago

  • Is duplicate of Bug #85604: PHP warning when doing math in Fluid added
Actions #5

Updated by Wouter Wolters about 6 years ago

  • Status changed from Needs Feedback to Closed

Closing this ticket as duplicate of #85604

Actions #6

Updated by Oliver Hader over 5 years ago

  • Has duplicate Bug #87978: Missing declarations in MathExpressionNode.php added
Actions

Also available in: Atom PDF