-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support exit()
function in PHP 8.4
#185
base: master
Are you sure you want to change the base?
Conversation
This change seems to allow me to hook an Can someone help me out?
|
c2ba746
to
f39ef57
Compare
Note that I've pushed a commit regarding the proper calling convention (otherwise won't build on Windows, and might have issues on other platforms). And I have force-pushed to get the latest CI improvements (faster/more reliable builds on Windows; fail-fast:false, so the tests will run). |
Oh, and thank you for the PR! This might be getting somewhere. :) |
@cmb69 Thank you for your support! |
Instead of fiddling with the exit function handler, what is brittle at best, we employ the return mechanism to install our own exit handler function.
This are certainly no longer valid since we create an additional closure, but relying on these numbers rarely makes sense anyway.
This still needs some work:
|
We override exit/die on request startup, so we should clean that up on request shutdown.
uopz already implements its own `call_user_func(_array)`, so we do the same with `exit`. While the former has different reasons (compiler might optimize these calls away), the use case is similar enough to not use a different mechanism. This is also a bit cleaner, and may avoid crashes[1], at the cost of needing to maintain a copy of the exit function implementation. [1] <krakjoe@e902fb2>
This reverts commit 8af6a49.
While the clean-up turned out rather different to what I had in mind (I completely changed the return mechanism approach, back to swapping the exit handler), this looks good to me now. User who want to, can now use Thank you @zonuexe for getting this into motion! If you find some time, please check that everything works as desired now. |
@cmb69 I really appreciate your work. I don't have any code that depends on |
Maybe @remicollet is still interested in uopz, and will have a look at this PR? |
The
ZEND_EXIT
directive has been removed in PHP 8.4, so ignore it and overwrite the exit function instead.resolve #184