Bug #75980 [Nab]: greater or equal (formerly >=) is missinterpreted

From: Date: Mon, 19 Feb 2018 13:22:38 +0000
Subject: Bug #75980 [Nab]: greater or equal (formerly >=) is missinterpreted
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214035@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75980&edit=1 ID: 75980 Updated by: cmb@php.net Reported by: rolf at rolfjentsch dot de Summary: greater or equal (formerly >=) is missinterpreted Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: windows 10 xamp PHP Version: 7.2.2 Block user comment: N Private report: N New Comment: Besides what nikic said: if you're experiencing such strange behavior again, have a look at the generated HTML source code! Previous Comments: ------------------------------------------------------------------------ [2018-02-19 13:22:31] spam2 at rhsoft dot net > well to make it a final the problem only arrises when i > start my php section with <?. > it does not occur when i start it with <?php well, to make it final: that's why you should not mix different issues in one bugreport and hence your broken snippet has alos no place in https://bugs.php.net/bug.php?id=73232 http://php.net/manual/en/ini.core.php#ini.short-open-tag <? is short-open-tags which defaults for years now to disabled that it worked in some configuration with 5.6 was because someone enabled it you can build PHP7 with --disable-short-tags and that's what you see because you ignored that many years that you shold write <?php and not <? but as said: this "issue" which is none has no place in that bugreport which is about something cmpletly differnt at all ------------------------------------------------------------------------ [2018-02-19 13:18:34] nikic@php.net Please check your "short_open_tag" ini setting. You have it enabled on PHP 5 and disabled on PHP 7. ------------------------------------------------------------------------ [2018-02-19 13:18:29] jhdxr@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php > But a if(strpos($_SERVER['SERVER_ADDR'],"192.168.10") !< 0) still does > what it does in previous versions !< is an invalid operator in PHP, please double check the manual (http://php.net/manual/en/language.operators.php) before you try to create something. btw, rhsoft has already point out that you should read the manual to see how strpos works, especially the warning message in red box. ------------------------------------------------------------------------ [2018-02-19 13:17:03] rolf at rolfjentsch dot de well to make it a final the problem only arrises when i start my php section with <?. it does not occur when i start it with <?php ------------------------------------------------------------------------ [2018-02-19 13:11:06] spam2 at rhsoft dot net so what is now with your wrong statement that >= finish interpreting? > But a if(strpos($_SERVER['SERVER_ADDR'],"192.168.10") !< 0) > still does what it does in previous versions frankly i have no idea why one would write this code and what it is supposed to do! strpos() either returns a integer which can be anything including 0 where 0 is the pretty clear fact "haystack starts with needle" in case needle don't exist in the string it returns a boolean false which is ducmented behavior for decades - so the only correct code tests if the result is a boolean false and this MUST be done with !== or === depending on the logic you implement compare return values which can be 0 or boolean in weak mode is and always was wrong - that's it - when your code for comparison is not strict PHP needs to implicit cast *one* of both values to the type of the other which makes a 0 to false or false to 0 depending on the order and so the result is just by luck that's it - that didn't change and completly off-topic assertions like >= stops interpreting making such bugreports even more worse - there is no bug, your expectations are just wrong and with reading the documentation you would not have written >= to start with http://php.net/manual/en/function.strpos.php Warning This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on Booleans for more information. Use the === operator for testing the return value of this function. ------------------------------------------------------------------------ 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=75980 -- Edit this bug report at https://bugs.php.net/bug.php?id=75980&edit=1

« previous php.bugs (#214035) next »