summaryrefslogtreecommitdiff
path: root/src/snuffleupagus.c
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-08-06 16:39:03 +0200
committerBen Fuhrmannek2021-08-06 16:39:03 +0200
commitbaecad40b5b8a977ce2a42f9ad1e31820254ae6e (patch)
tree149111f9704d32df38a3761f936be58201af041d /src/snuffleupagus.c
parent62f6d31d88e4536269b60471d7a4f7431442276a (diff)
debug log to dup'd stderr / php is closing stderr during shutdown
Diffstat (limited to 'src/snuffleupagus.c')
-rw-r--r--src/snuffleupagus.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c
index d8a86b5..8c7ecbf 100644
--- a/src/snuffleupagus.c
+++ b/src/snuffleupagus.c
@@ -13,6 +13,10 @@
13static PHP_INI_MH(OnUpdateConfiguration); 13static PHP_INI_MH(OnUpdateConfiguration);
14static inline void sp_op_array_handler(zend_op_array *op); 14static inline void sp_op_array_handler(zend_op_array *op);
15 15
16#ifdef SP_DEBUG_STDERR
17int sp_debug_stderr = STDERR_FILENO;
18#endif
19
16ZEND_EXTENSION(); 20ZEND_EXTENSION();
17 21
18// LCOV_EXCL_START 22// LCOV_EXCL_START
@@ -70,6 +74,10 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = {
70 STANDARD_ZEND_EXTENSION_PROPERTIES}; 74 STANDARD_ZEND_EXTENSION_PROPERTIES};
71 75
72static PHP_GINIT_FUNCTION(snuffleupagus) { 76static PHP_GINIT_FUNCTION(snuffleupagus) {
77#ifdef SP_DEBUG_STDERR
78 sp_debug_stderr = dup(STDERR_FILENO);
79#endif
80 sp_log_debug("(GINIT)");
73 snuffleupagus_globals->is_config_valid = SP_CONFIG_NONE; 81 snuffleupagus_globals->is_config_valid = SP_CONFIG_NONE;
74 snuffleupagus_globals->in_eval = 0; 82 snuffleupagus_globals->in_eval = 0;
75 83
@@ -116,6 +124,7 @@ static PHP_GINIT_FUNCTION(snuffleupagus) {
116} 124}
117 125
118PHP_MINIT_FUNCTION(snuffleupagus) { 126PHP_MINIT_FUNCTION(snuffleupagus) {
127 sp_log_debug("(MINIT)");
119 REGISTER_INI_ENTRIES(); 128 REGISTER_INI_ENTRIES();
120 129
121 return SUCCESS; 130 return SUCCESS;
@@ -134,6 +143,7 @@ static inline void free_disabled_functions_hashtable(HashTable *const ht) {
134} 143}
135 144
136static PHP_GSHUTDOWN_FUNCTION(snuffleupagus) { 145static PHP_GSHUTDOWN_FUNCTION(snuffleupagus) {
146 sp_log_debug("(GSHUTDOWN)");
137#define FREE_HT(F) \ 147#define FREE_HT(F) \
138 zend_hash_destroy(snuffleupagus_globals->F); \ 148 zend_hash_destroy(snuffleupagus_globals->F); \
139 pefree(snuffleupagus_globals->F, 1); 149 pefree(snuffleupagus_globals->F, 1);
@@ -188,6 +198,11 @@ static PHP_GSHUTDOWN_FUNCTION(snuffleupagus) {
188 FREE_CFG(config_disabled_functions_reg_ret); 198 FREE_CFG(config_disabled_functions_reg_ret);
189#undef FREE_CFG 199#undef FREE_CFG
190#undef FREE_CFG_ZSTR 200#undef FREE_CFG_ZSTR
201
202#ifdef SP_DEBUG_STDERR
203 close(sp_debug_stderr);
204 sp_debug_stderr = STDERR_FILENO;
205#endif
191} 206}
192 207
193PHP_RINIT_FUNCTION(snuffleupagus) { 208PHP_RINIT_FUNCTION(snuffleupagus) {
@@ -249,6 +264,8 @@ PHP_MINFO_FUNCTION(snuffleupagus) {
249} 264}
250 265
251static PHP_INI_MH(OnUpdateConfiguration) { 266static PHP_INI_MH(OnUpdateConfiguration) {
267 sp_log_debug("(OnUpdateConfiguration)");
268
252 TSRMLS_FETCH(); 269 TSRMLS_FETCH();
253 270
254 if (!new_value || !new_value->len) { 271 if (!new_value || !new_value->len) {