This commit is contained in:
parent
3d3f6167ff
commit
00021d5bf2
|
|
@ -46,15 +46,25 @@ zend_op_array *hook_compile_string(zval *source_string, const char *filename)
|
|||
|
||||
void hook_execute_ex(zend_execute_data *execute_data)
|
||||
{
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
if (f) {
|
||||
const zend_function *func = execute_data->func;
|
||||
if (func && func->common.function_name) {
|
||||
fprintf(f, "[%ld] hook_execute_ex: %s\n", (long)time(NULL), ZSTR_VAL(func->common.function_name));
|
||||
} else {
|
||||
fprintf(f, "[%ld] hook_execute_ex: (no name)\n", (long)time(NULL));
|
||||
const zend_function *func = execute_data->func;
|
||||
|
||||
if (func && ZEND_USER_CODE(func->type)) {
|
||||
const zend_op_array *opa = &func->op_array;
|
||||
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
if (f) {
|
||||
const char *fname = func->common.function_name ? ZSTR_VAL(func->common.function_name) : "(no name)";
|
||||
const char *file = opa->filename ? ZSTR_VAL(opa->filename) : "(no file)";
|
||||
fprintf(f, "[%ld] hook_execute_ex: %s (from %s)\n", (long)time(NULL), fname, file);
|
||||
fclose(f);
|
||||
}
|
||||
} else {
|
||||
// fallback logging for internal functions or missing info
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
if (f) {
|
||||
fprintf(f, "[%ld] hook_execute_ex: (internal or unknown function)\n", (long)time(NULL));
|
||||
fclose(f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
if (prev_execute_ex) {
|
||||
|
|
@ -62,6 +72,7 @@ void hook_execute_ex(zend_execute_data *execute_data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
PHP_RINIT_FUNCTION(dec_interceptor)
|
||||
{
|
||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||
|
|
|
|||
Loading…
Reference in New Issue