bug #39196 [DI] Fix Xdebug 3.0 detection (vertexvaar)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[DI] Fix Xdebug 3.0 detection

| Q             | A
| ------------- | ---
| Branch?       | 4.4 (for bug fixes)
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39195
| License       | MIT
| Doc PR        | n/a

Xdebug 3.0 removed the function `xdebug_is_enabled()`. To detect if Xdebug 3.0 is installed (it doesn't even need to be enabled to reproduce the bug) i added `function_exists('xdebug_info')`. AFAIS `xdebug_info()` is available in Xdebug >= 3.0 only.

Commits
-------

38f8edddb1 [DI] Fix Xdebug 3.0 detection
This commit is contained in:
Nicolas Grekas 2020-12-08 15:03:26 +01:00
commit 891e2afb64
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ class AutowiringFailedException extends RuntimeException
{
$this->serviceId = $serviceId;
if ($message instanceof \Closure && \function_exists('xdebug_is_enabled') && xdebug_is_enabled()) {
if (
$message instanceof \Closure
&& (\function_exists('xdebug_is_enabled') ? xdebug_is_enabled() : \function_exists('xdebug_info'))
) {
$message = $message();
}