8000 Avoid overriding PHP hooks when Obs. API is used by NoiseByNorthwest · Pull Request #322 · NoiseByNorthwest/php-spx · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions src/php_spx.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,29 @@ static PHP_MINIT_FUNCTION(spx)
{
spx_php_global_hooks_init();

REGISTER_INI_ENTRIES();

#ifdef ZTS
spx_php_global_hooks_set(0);
#endif
/*
Overriding the zend_execute_ex hook disables the PHP JIT.
For this reason, it is avoided here when the alternative instrumentation
infrastructure (Zend Observer API) is enabled.

REGISTER_INI_ENTRIES();
The main limitation of this approach is that SPX can no longer intercept
HTTP request handling (for web server SAPIs such as FPM, mod_php, or CGI)
to serve its own web UI instead.

However, this limitation is relatively minor, since PHP is typically not
built with ZTS in those contexts (except on Windows).

We can therefore assume that PHP will be ZTS-enabled in new generation
runtime environments (e.g. FrankenPHP), where the web UI can be served
via spx_ui_handle_request() instead.
*/
if (! SPX_G(use_observer_api)) {
spx_php_global_hooks_set(0);
}
#endif

return SUCCESS;
}
Expand Down
0