From 2105928a9848dac1867d681ee9e004595ea73089 Mon Sep 17 00:00:00 2001 From: xXx-caillou-xXx Date: Mon, 20 Aug 2018 10:50:58 +0200 Subject: Fix two minor issues - Fix an infinite loop on `echo` hook - Use the correct function to compare filenames internally --- src/snuffleupagus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/snuffleupagus.c') diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 3f9e1eb..ff0c6c3 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c @@ -265,12 +265,14 @@ static PHP_INI_MH(OnUpdateConfiguration) { // This is needed to implement the global strict mode CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY; } - if (zend_hash_str_find( + + // If `zend_write_default` is not NULL it is already hooked. + if ((zend_hash_str_find( SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, "echo", strlen("echo")) || zend_hash_str_find( SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, "echo", - strlen("echo"))) { + strlen("echo"))) && NULL == zend_write_default) { zend_write_default = zend_write; zend_write = hook_echo; } -- cgit v1.3