Skip to content

[ErrorHandler] FatalError raise warning if Xdebug 3 is not in develop mode #40677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jean85 opened this issue Apr 2, 2021 · 0 comments
Closed

Comments

@Jean85
Copy link
Contributor

Jean85 commented Apr 2, 2021

Symfony version(s) affected: at least since 4.4.0

Description
When using Xdebug 3 with develop mode disabled (i.e. for coverage in CI), a warning is triggered inside Symfony\Component\ErrorHandler\Error\FatalError due to this like of code:

if (\function_exists('xdebug_get_function_stack')) {

How to reproduce

  • install Xdebug 3 and enable it WITHOUT develop mode
  • install the Error Handler and enable it
  • throw an exception and do NOT catch it
Warning: Function must be enabled in php.ini by setting 'xdebug.mode' to 'develop'

Example of failure: https://github.com/getsentry/sentry-symfony/pull/475/checks?check_run_id=2247826488#step:9:25

So, function_exists is no longer good enough for safeguarding such usage. Also, it seems that checking for xdebug.mode from the ini is not good enough too: https://xdebug.org/docs/develop#mode

You can also set the mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will no change the value of the xdebug.mode setting.

@Jean85 Jean85 added the Bug label Apr 2, 2021
xabbuh added a commit that referenced this issue Apr 6, 2021
…elop mode disabled (Jean85)

This PR was merged into the 4.4 branch.

Discussion
----------

[Debug][ErrorHandler] Avoid warning with Xdebug 3 with develop mode disabled

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #40677
| License       | MIT

As reported in #40677, this fix is needed when Xdebug 3 is enabled but its `develop` mode is off.

Commits
-------

0e0639b Avoid warning with Xdebug 3 with develop mode disabled
@xabbuh xabbuh closed this as completed Apr 6, 2021
nicolas-grekas added a commit that referenced this issue May 15, 2024
…h xdebug >= 3.0 when not in develop mode (fmata)

This PR was merged into the 5.4 branch.

Discussion
----------

[ErrorHandler] Do not call xdebug_get_function_stack() with xdebug >= 3.0 when not in develop mode

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #40677
| License       | MIT

The PR #40787 was rejected because of env var handling in xdebug_mode. xdebug/xdebug#737 allow us to get xdebug_mode in all cases so I think we can merge this PR safely.

Tested on my setup successfully, I have no more warning.

Thanks `@ralphschindler` :)

Commits
-------

a8114fe [ErrorHandler] Do not call xdebug_get_function_stack() with xdebug >= 3.0 when not in develop mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants