[PHP-BUG] Req #78822 [NEW]: Returning from multiple function calls
[email protected] ("mail-roboczy-dla-forow at wp dot pl") Sat, 16 Nov 2019 01:34:41 +0000
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: mail-roboczy-dla-forow at wp dot pl
Operating system: All
PHP version: Next Minor Version
Package: PHP Language Specification
Bug Type: Feature/Change Request
Bug description:Returning from multiple function calls
Description:
------------
function analyze($anyParameter)
{
foreach($anyParameter as &$v)
b($v);
}
function b(&$obj)
{
foreach($obj as $line)
{
$res=c($line);
}
if(...)
{
...
$res=b(substr($line,3)); /* recurrent function */
...
}
...
}
function c(&$line)
{
if($line=='1')
return 3;
if($line=='2')
return 4;
if($line=='unexpected data')
[analyze] return false; /* return from previous calls
and return 'false' from
'analyze' function and
continue execution from
next instruction after
last 'analyze' call. */
return -1;
}
Test script:
---------------
No test script, the functionality will help faster return from multiple
calls, for example analyzing jpeg, gif or odt files. It is the common
situation that the analyzing function identyify unexpected data and the
analysis must by broken due to nonsense data and returns error code.
It is possible to write code without this enhancement but the code will
be longer and will contain additional conditions slowing execution of
multiple nested calls.
Expected result:
----------------
additional syntax
[functionName] return result;
--
Edit bug report at https://bugs.php.net/bug.php?id=78822&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78822&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78822&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78822&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78822&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78822&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78822&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78822&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78822&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78822&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78822&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78822&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78822&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78822&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78822&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78822&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78822&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78822&r=mysqlcfg