Bug #76927 [NEW]: Assignments in "if" conditions
| From: | davide dot spagnoli at adam-italia dot it | Date: | Mon, 24 Sep 2018 15:49:14 +0000 |
| Subject: | Bug #76927 [NEW]: Assignments in "if" conditions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217216@lists.php.net to get a copy of this message | ||
From: davide dot spagnoli at adam-italia dot it
Operating system: CentOS Linux release 7.5.1804 (C
PHP version: 7.1.22
Package: *General Issues
Bug Type: Bug
Bug description:Assignments in "if" conditions
Description:
------------
In a set of conditions evaluated by an "if" block, an assignment is not
recognized by next conditions.
Test script:
---------------
$i=1;
if($i++==1 && $i==2){
echo "I'm in";
}
// output "I'm in"
if($j=1 && $j++==1 && $j==2){
echo "I'm in again";
}
// notice "Undefined variable: j" and no output
Expected result:
----------------
output: "I'm in"
output: "I'm in again"
Actual result:
--------------
output: "I'm in"
notice "Undefined variable: j" and no output
--
Edit bug report at https://bugs.php.net/bug.php?id=76927&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76927&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76927&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76927&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76927&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76927&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76927&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76927&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76927&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76927&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76927&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76927&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76927&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76927&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76927&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76927&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76927&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76927&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76927&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76927&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76927&r=mysqlcfg