On Wed, 2015-10-28 at 16:45 +0000, Rowan Collins wrote: > On the downside, it's worth noting that while PHP destructors are > technically deterministic, the language can actually prevent them > running on scope exit, because Exceptions hold references to everything > used as a parameter in their stack traces. > > In the below very simple example, both err() and foo() have completed, > but the destructor fires only once the Exception is caught and > discarded. So if you passed your ScopeGuard object around at all, you > might find things executing in a surprising order.
That's an interesting case, I in fact didn't think about, but I believe a scope guard / RAII object should not be passed to another scope. johannes -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php