diff --git a/tests/bug01262.phpt b/tests/bug01262.phpt new file mode 100644 index 000000000..dc45b0f79 --- /dev/null +++ b/tests/bug01262.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test for bug #1262: overload_var_dump=0 messes with xdebug_var_dump() +--INI-- +xdebug.default_enable = 1 +xdebug.overload_var_dump = 0 +html_errors = 1 +--FILE-- + +--EXPECT-- +
string 'Anything' (length=8)
+
+string(8) "Anything" diff --git a/xdebug.c b/xdebug.c index d02f8e17b..9612e9f9c 100644 --- a/xdebug.c +++ b/xdebug.c @@ -2190,8 +2190,18 @@ PHP_FUNCTION(xdebug_var_dump) int argc; int i, len; char *val; - - if (!XG(overload_var_dump)) { + + /* Ignore our new shiny function if overload_var_dump is set to 0 *and* the + * function is not being called as xdebug_var_dump() (usually, that'd be + * the overloaded var_dump() of course). Fixes issue 1262. */ + if ( + !XG(overload_var_dump) +#if PHP_VERSION_ID >= 70000 + && (strcmp("xdebug_var_dump", execute_data->func->common.function_name->val) != 0) +#else + && (strcmp("xdebug_var_dump", EG(current_execute_data)->function_state.function->common.function_name) != 0) +#endif + ) { XG(orig_var_dump_func)(INTERNAL_FUNCTION_PARAM_PASSTHRU); return; }