From: kok at nachon dot nl
Operating system: Irrelevant
PHP version: 5.2.6
PHP Bug Type: Feature/Change Request
Bug description: Break out of compound blocks.
Description:
------------
I read in Bug #29287 about breaking out of loops and was wondering if
anyone considered breaking out of a generic compound block. This would
satisfy the need for error handling without goto.
Example:
function connect() {
{ //start compound block
if (!mysql_connect('host', 'user', 'pass)) break; //break out
if (!mysql_select_db('database')) break; //break out
return;
}
$code = mysql_errno();
$msg = mysql_error();
throw new Exception($msg, $code);
}
--
Edit bug report at http://bugs.php.net/?id=46158&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46158&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46158&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46158&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46158&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46158&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46158&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46158&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46158&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46158&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46158&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46158&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46158&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46158&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46158&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46158&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46158&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46158&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46158&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46158&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46158&r=mysqlcfg