Bug #73468 [Nab]: PHP 7.1: PHP Notice: A non well formed numeric value encountered

From: Date: Sun, 10 Sep 2017 20:17:21 +0000
Subject: Bug #73468 [Nab]: PHP 7.1: PHP Notice: A non well formed numeric value encountered
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211038@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73468&edit=1 ID: 73468 Updated by: requinix@php.net Reported by: spam2 at rhsoft dot net Summary: PHP 7.1: PHP Notice: A non well formed numeric value encountered Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 7.1.0RC5 Block user comment: N Private report: N New Comment: @develway: This isn't a blog. If you think you found a bug (you didn't) then make your own bug report. $d is "257.2<br>". http://php.net/manual/en/language.operators.precedence.php Previous Comments: ------------------------------------------------------------------------ [2017-09-10 20:13:17] develway at gmail dot com echo $d = $b + $c . BR; //but why PHP doesn't understand that is float? echo $e = (float)$d * $b . BR; ------------------------------------------------------------------------ [2017-09-10 20:08:05] develway at gmail dot com Notice disappear, but code is ugly :) echo (float)$e = (float)$d * (float)$b . BR; I agree that now to avoid Notice we must to typecast expected result, what PHP did for more than a decade itself!!! ------------------------------------------------------------------------ [2017-09-10 19:59:42] develway at gmail dot com I wanted to say, that I don't get what solution must be ... const BR = "<br>"; $a = 1; $b = 2.5; $c = 0xFF; echo $d = $b + $c . BR; echo $e = $d * $b . BR; In the last line the result expected to be float, why appears this Notice: A non well formed numeric value encountered? ------------------------------------------------------------------------ [2017-09-10 19:41:21] develway at gmail dot com I don't get the point about solution? for example for this simple code in the last line I get the same Notice: A non well formed numeric value encountered const BR = "<br>"; $a = 1; $b = 2.5; $c = 0xFF; echo $d = $b + $c . BR; echo $e = $d * $b . BR; ------------------------------------------------------------------------ [2016-11-06 21:42:55] spam2 at rhsoft dot net and BTW - fine that you mention the codeline - what about mention the VARIABLE which the warning is raising? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73468 -- Edit this bug report at https://bugs.php.net/bug.php?id=73468&edit=1

« previous php.bugs (#211038) next »