Bug #76568 [NEW]: For loop does not through error when Left bracket does not follow right paren

From: Date: Mon, 02 Jul 2018 22:48:21 +0000
Subject: Bug #76568 [NEW]: For loop does not through error when Left bracket does not follow right paren
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216085@lists.php.net to get a copy of this message
From: andrew dot marek at sbcglobal dot net Operating system: CENTOS 6.4 PHP version: 5.6.36 Package: Scripting Engine problem Bug Type: Bug Bug description:For loop does not through error when Left bracket does not follow right paren Description: ------------ Note below that the For loop's left bracket does not immediately follow the for loop conditional's right closing bracket. The interpreter does not throw an error and permits this code to execute. Result: For loop does nothing - whether it tries to execute, gets confused, or simply ignores the code - I don't know - the actual result is the program runs and the For loop fails. Fix: Once the interpreter detects a for loop the syntax checker should demand an opening bracket to immediately follow the closing paren on the for loop's conditional. Test script: --------------- for ($ib = 0; $ib < $ncountp; $ib = $ib + 14) $ib1 = $ib + 1; $ib2 = $ib + 2; $ib3 = $ib + 3; $ib4 = $ib + 4; $ib5 = $ib + 5; $ib6 = $ib + 6; $ib7 = $ib + 7; $ib8 = $ib + 8; $ib9 = $ib + 9; $ib10 = $ib + 10; $ib11 = $ib + 11; {$ib12 = $ib + 12; $ib13 = $ib + 13; if (isset($ivcarrp[$ib13])) {if ($ivcarrp[$ib13] == "XX") {$bypasscnt++; continue;} } } -- Edit bug report at https://bugs.php.net/bug.php?id=76568&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76568&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76568&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76568&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76568&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76568&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76568&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76568&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76568&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76568&r=support Expected behavior: https://bugs.php.net/fix.php?id=76568&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76568&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76568&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76568&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76568&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76568&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76568&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76568&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76568&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76568&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76568&r=mysqlcfg

« previous php.bugs (#216085) next »