From: ntpt at seznam dot cz
Operating system: linux
PHP version: 5.2.12
PHP Bug Type: *Programming Data Structures
Bug description: return() in short-circuit / lazy evaluation
Description:
------------
please allow return() in lazy evaluation /short-circuit syntax like
$result=do_something($blah) or die('nothing done'); // this works
but
$result=do_something($blah) or return(false) ; // does NOT work
I thing it is prety legitimate not only to call die() if do_something()
return false, but in this case return() from function or include() as well.
I thing it is more cleaner and readable then bunch of
$result=do_something($blah)
if ($result==false){
return false;}
// use you result here
Maybe even codeblock after "or" is worth of considerations
$result=do_something($blah) or { // codeblock, do what you want here
}
--
Edit bug report at http://bugs.php.net/?id=50515&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50515&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50515&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50515&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50515&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50515&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50515&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50515&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50515&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50515&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50515&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50515&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50515&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50515&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50515&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50515&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50515&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50515&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50515&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50515&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50515&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50515&r=mysqlcfg