From: ceefour at gauldong dot net
Operating system: All
PHP version: 5.0.3
PHP Bug Type: Zend Engine 2 problem
Bug description: Request 'finally' support for exceptions
Description:
------------
PHP 5 has specifically decided not to support 'finally'. Why?
This is one of numerous cases why finally is useful:
mysql_query("LOCK TABLES mytable WRITE");
try {
// ... do lots of queries here
} finally {
mysql_query("UNLOCK TABLES");
}
You need to use UNLOCK TABLES otherwise your tables won't get unlocked
when an exception is thrown. This is especially bad if you use persistent
connections.
It is possible to emulate finally using try/catch but this introduces code
redundancy and may create inconsistent code:
mysql_query("LOCK TABLES mytable WRITE");
try {
// ... do lots of queries here
mysql_query("UNLOCK TABLES");
} catch(Exception $e) {
mysql_query("UNLOCK TABLES");
throw $e;
}
--
Edit bug report at http://bugs.php.net/?id=32100&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32100&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32100&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32100&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32100&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32100&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32100&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32100&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32100&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32100&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32100&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32100&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32100&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32100&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32100&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32100&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32100&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32100&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32100&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32100&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32100&r=mysqlcfg