This commit is contained in:
parent
3d3f6167ff
commit
00021d5bf2
|
|
@ -46,22 +46,33 @@ zend_op_array *hook_compile_string(zval *source_string, const char *filename)
|
||||||
|
|
||||||
void hook_execute_ex(zend_execute_data *execute_data)
|
void hook_execute_ex(zend_execute_data *execute_data)
|
||||||
{
|
{
|
||||||
|
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");
|
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||||
if (f) {
|
if (f) {
|
||||||
const zend_function *func = execute_data->func;
|
const char *fname = func->common.function_name ? ZSTR_VAL(func->common.function_name) : "(no name)";
|
||||||
if (func && func->common.function_name) {
|
const char *file = opa->filename ? ZSTR_VAL(opa->filename) : "(no file)";
|
||||||
fprintf(f, "[%ld] hook_execute_ex: %s\n", (long)time(NULL), ZSTR_VAL(func->common.function_name));
|
fprintf(f, "[%ld] hook_execute_ex: %s (from %s)\n", (long)time(NULL), fname, file);
|
||||||
} else {
|
|
||||||
fprintf(f, "[%ld] hook_execute_ex: (no name)\n", (long)time(NULL));
|
|
||||||
}
|
|
||||||
fclose(f);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prev_execute_ex) {
|
if (prev_execute_ex) {
|
||||||
prev_execute_ex(execute_data);
|
prev_execute_ex(execute_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PHP_RINIT_FUNCTION(dec_interceptor)
|
PHP_RINIT_FUNCTION(dec_interceptor)
|
||||||
{
|
{
|
||||||
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
FILE *f = fopen("/tmp/dec_interceptor.log", "a");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue