Req #72548 [NEW]: Limit for number of lines in foreach loop
| From: | nanovim at gmail dot com | Date: | Tue, 05 Jul 2016 14:12:42 +0000 |
| Subject: | Req #72548 [NEW]: Limit for number of lines in foreach loop | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202070@lists.php.net to get a copy of this message | ||
From: nanovim at gmail dot com
Operating system: Any
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Limit for number of lines in foreach loop
Description:
------------
I would suggest that the php interpreter/compiler would have an option
to set a maximal number of lines for a foreach loop.
We PHP Programmers love the foreach loops and they are quite usefully,
but it seems this love seems often unconditional and often projects have
foreach loops with hundred lines of code. This foreach loops might even
complex if/then/else constructs, which may have itself foreach loops.
I think we should give the project maintainer an option to limit the
number of lines of code of the foreach loops of a project.
Let's say an option in the php.ini like: foreach-limit: -1 which can be
set to any Integer and -1 indicating no limit at all.
Test script:
---------------
foreach($arrray as $line)[
//200 lines and a limit of 50
}
Expected result:
----------------
Parser error: limit of lines succeeded
Actual result:
--------------
it compiles
--
Edit bug report at https://bugs.php.net/bug.php?id=72548&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72548&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72548&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72548&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72548&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72548&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72548&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72548&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72548&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72548&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72548&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72548&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72548&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72548&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72548&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72548&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72548&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72548&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72548&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72548&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72548&r=mysqlcfg