On 07/24/2012 10:01 AM, Nikita Popov wrote: > Another, separate point against finally is that in PHP (unlike many > other languages) most (all?) built-in resources clean up after > themselves. So if you open a file you don't have to worry about > closing it again. It'll do that all by itself as soon as it goes out > of scope. The same applies to database handles, etc. As PHP uses > refcount based garbage collection the resource is actually cleaned up > right away, not just at the next GC run (which could be problematic if > you open up many files in a row).
Which is the argument for why finally doesn't need to worry about the fatal-error case. Most resources are cleaned up on a fatal already, including your lock example, so it isn't an issue. finally is exception-level for intra-app cleanup, not for request shutdown cleanup. We already have shutdown functions for that case. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php