[php-src] Issue #7895: Uncaught TypeError: Unsupported operand types: string * string in

From: Date: Thu, 06 Jan 2022 12:54:01 +0000
Subject: [php-src] Issue #7895: Uncaught TypeError: Unsupported operand types: string * string in
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238807@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7895 Comment Author: iluuu1994 @tolgahanacar You cannot multiply these operands. What result would you expect "USD" * "1" to be? What exactly your application is supposed to do when the operands aren't what you expect them to be, only you can know. ```php $currency = json_decode(file_get_contents('https://api.example.com/embed/currency.json'), true); $value = filter_var($_POST['value'], FILTER_VALIDATE_INT); $usd = filter_var($currency['USD']['sale'], FILTER_VALIDATE_INT); if ($value === false || $usd === false) { // Do something else } echo $value * $usd; ```

« previous php.bugs (#238807) next »