Bug #75980 [Com]: greater or equal (formerly >=) is missinterpreted
| From: | spam2 at rhsoft dot net | Date: | Mon, 19 Feb 2018 12:43:54 +0000 |
| Subject: | Bug #75980 [Com]: greater or equal (formerly >=) is missinterpreted | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214024@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
Comment by: spam2 at rhsoft dot net
Reported by: rolf at rolfjentsch dot de
Summary: greater or equal (formerly >=) is missinterpreted
Status: Open
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:
it would be a good start to write proper code and then it even works
>= 0 when comparing the boolean 'false' triggers implict type-casting and false weak
>compared to 0 is the same as int 0 when the string starts with needle
that this worked in some arbitary PHP version was just by luck
- if(strpos($_SERVER['SERVER_ADDR'],"192.168.10") >= 0)
+ if(strpos($_SERVER['SERVER_ADDR'],"192.168.10") !== false)
Previous Comments:
------------------------------------------------------------------------
[2018-02-19 12:41:36] rolf at rolfjentsch dot de
Processing a .php document is done wrong imho.
When a statement like "if (strpos($_SERVER['SERVER_ADDR'],"192.168.10")
>= 0)"
is proccessed it does not compare but finishes to interpret (which would be fine if there is a
"?>") but the compare option ">=" finishes interpretation of the source
and echoes in the above example "= 0)"
This appplies to all php 7 versions i have tested so far either on ubuntu or on xammp.
------------------------------------------------------------------------
[2018-02-19 12:18:30] peehaa@php.net
It's not clear at all what this bug report is trying to... report.
Please provide clear information regarding the expected output, the actual output and a proper test
case.
------------------------------------------------------------------------
[2018-02-19 12:13:26] rolf at rolfjentsch dot de
Description:
------------
Problem arrises when >= is processed something like "= 0) { $where="http://qnap/piwik/"; }" is echoed instead of doing
what it did in php 5.6
Below is a test script to reproduce the error
Test script:
---------------
<?
if (isset($_SERVER['SERVER_ADDR']))
{
if (strpos($_SERVER['SERVER_ADDR'],"192.168.10") >= 0)
{
$where="http://qnap/piwik/";
}
else
{
$where="https://someurlhere/";
}
} else $where="https://someurlhere/";
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75980&edit=1