View Issue Details

IDProjectCategoryView StatusLast Update
0002080XdebugStacktracespublic2022-03-28 09:03
ReporterAndreKR Assigned Toderick  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version3.0.4 
Summary0002080: function_exists true despite xdebug_get_function_stack disabled
Description

I have existing code like this:

if (function_exists('xdebug_get_function_stack'))
$stack = xdebug_get_function_stack();

Since some version of Xdebug this throws a warning:
PHP Warning: Function must be enabled in php.ini by setting 'xdebug.mode' to 'develop'

Apparently it isn't fatal, so I don't know what xdebug_get_function_stack() returns in this case (null maybe?) but wouldn't it be better if function_exists('xdebug_get_function_stack') was false if the function is "disabled"?

TagsNo tags attached.
Operating System
PHP Version7.4.20-7.4.29

Activities

derick

2022-03-28 09:03

administrator   ~0006257

Apparently it isn't fatal, so I don't know what xdebug_get_function_stack() returns in this case (null maybe?)

It returns an empty array, the same return type as it would use when it can return results.

but wouldn't it be better if function_exists('xdebug_get_function_stack') was false if the function is "disabled"?

Yes, that would be better. But I can't do that unless I "hack" PHP's internal function_exists(). This is because functions have to be compiled into PHP (compile time) whereas Xdebug needs to disable these per-process (runtime) due to various variations of the xdebug.mode setting. I'm not happy with this situation either, but as it shouldn't "break" code, and these functions are meant for development purposes (like Xdebug itself), I don't want to investigate coming up with hacks to do the result that you (and I) expected. Mostly, because these hacks are invariably going to cause some other issues that then require time and effort to figure out and fix.

Issue History

Date Modified Username Field Change
2022-03-28 04:40 AndreKR New Issue
2022-03-28 09:03 derick Assigned To => derick
2022-03-28 09:03 derick Status new => resolved
2022-03-28 09:03 derick Resolution open => won't fix
2022-03-28 09:03 derick Note Added: 0006257