#32100 [NEW]: Request 'finally' support for exceptions
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
Thread (53 messages)
- ceefour at gauldong dot net
- helly@php.net#32100 [Opn]: Request 'finally' support for exceptions
- ceefour at gauldong dot net#32100 [Opn]: Request 'finally' support for exceptions
- helly@php.net#32100 [Opn->Csd]: Request 'finally' support for exceptions
- a dot e at inne dot plReq #32100 [Com]: Request 'finally' support for exceptions
- orlandu96 at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- thuejk at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- torsten dot landmann at bauermedia dot comReq #32100 [Com]: Request 'finally' support for exceptions
- michael202 at gmx dot deReq #32100 [Com]: Request 'finally' support for exceptions
- phplasma at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- 128bitencrypted at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- c891652 at bofthew dot comReq #32100 [Com]: Request 'finally' support for exceptions
- matsubokkuri+php at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- joshuaswift at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- marcus at lastcraft dot comReq #32100 [Com]: Request 'finally' support for exceptions
- btsai at vrwarp dot comReq #32100 [Com]: Request 'finally' support for exceptions
- hardyanto dot donny at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- tyra3l at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- tyra3l at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- attila dot m dot magyar at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- gunter at web dot comReq #32100 [Com]: Request 'finally' support for exceptions
- php at techdp dot co dot ukReq #32100 [Com]: Request 'finally' support for exceptions
- adam dot pippin at ohmedia dot caReq #32100 [Com]: Request 'finally' support for exceptions
- ealexs at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- bat at flurf dot netReq #32100 [Com]: Request 'finally' support for exceptions
- dsberliner at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- ninzya at inbox dot lvReq #32100 [Com]: Request 'finally' support for exceptions
- viktor at zuiderkwast dot seReq #32100 [Com]: Request 'finally' support for exceptions
- chiestand at salk dot eduReq #32100 [Com]: Request 'finally' support for exceptions
- topaz dot php dot bugs at lt3 dot usReq #32100 [Com]: Request 'finally' support for exceptions
- php dot net at kenman dot netReq #32100 [Com]: Request 'finally' support for exceptions
- ben at last dot fmReq #32100 [Com]: Request 'finally' support for exceptions
- antoninweb at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- frederic dot hardy at mageekbox dot netReq #32100 [Com]: Request 'finally' support for exceptions
- andrew dot feller at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- ravilov at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- gudjonj at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- matthias at die-legendaeren dot deReq #32100 [Com]: Request 'finally' support for exceptions
- simon at stienen dot nameReq #32100 [Com]: Request 'finally' support for exceptions
- toplegocreator at hotmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- kavi at postpro dot netReq #32100 [Com]: Request 'finally' support for exceptions
- sgnezdov at fastmail dot fmReq #32100 [Com]: Request 'finally' support for exceptions
- jl235 at kent dot ac dot ukReq #32100 [Com]: Request 'finally' support for exceptions
- angelo at camargo dot wsReq #32100 [Com]: Request 'finally' support for exceptions
- pieceofchum at yahoo dot comReq #32100 [Com]: Request 'finally' support for exceptions
- laruence@php.netReq #32100 [Csd->ReO]: Request 'finally' support for exceptions
- pravdin at vl dot ruReq #32100 [Com]: Request 'finally' support for exceptions
- laruence@php.netReq #32100 [ReO]: Request 'finally' support for exceptions
- ceefour at gauldong dot netReq #32100 [ReO]: Request 'finally' support for exceptions
- ceefour at gauldong dot netReq #32100 [Com]: Request 'finally' support for exceptions
- laruence@php.netReq #32100 [ReO->Csd]: Request 'finally' support for exceptions
- andrew dot feller at gmail dot comReq #32100 [Com]: Request 'finally' support for exceptions
- laruence@php.netReq #32100 [Csd]: Request 'finally' support for exceptions