facebook/hhvm — pull request #3121 by tstarling (2014-07-07 03:03:51+00:00)
Title: EZC: fix crash due to EG(exception) being transmitted between requests

When an exception was thrown from EZC, EG(exception) was left holding a
reference to the smart-allocated exception object, even after the end of
the request. At the end of the request, the object storage was freed by
resetAllocator(), then when zend_wrap_func() was entered in the next
request, EG(exception) would be freed again, causing a crash.

Fixed by installing request event handlers. The requestInit() handler is
analogous to Zend's init_executor().