View Issue Details

IDProjectCategoryView StatusLast Update
0001745XdebugStacktracespublic2020-02-27 16:19
ReporterPirateKing Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version2.9.2 
Summary0001745: Xdebug removes args array from Exception trace array
Description

For some reason Xdebug removes the args array from Exception trace array as can be seen on the attached screenshots.

PHP version:
PHP 7.4.2 (cli) (built: Jan 21 2020 11:35:20) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies
with Xdebug v2.9.2, Copyright (c) 2002-2020, by Derick Rethans

The issue does not exist with a PHP 7.4.2 image without Xdebug.

I noticed this issue as we are upgrading our app from PHP 7.2 to 7.4 and our CI pipeline started failing because we have this line in the code:

$propertyPath = $exception->getTrace()[0]['args'][1];

and the args array gets somehow removed by Xdebug which wasn't the case before.

Our current CI pipeline which uses a PHP 7.2.24 image with Xdebug 2.9.1 does not have this issue.

TagsNo tags attached.
Attached Files
Operating SystemCentOS
PHP Version7.4.0-7.4.4

Activities

derick

2020-02-13 15:49

administrator   ~0005242

Can you provide a self-contained example so that I can (try to) reproduce this?

PirateKing

2020-02-13 16:08

reporter   ~0005243

Minimal self-contained example:

function testFoo($bar)
{
throw new \Exception();
}

try {
testFoo('foobar');
} catch (Exception $exception) {
var_dump($exception);
}

This can be also reproduced in the web context.

derick

2020-02-14 18:36

administrator   ~0005245

That outputs:

<pre>
derick@singlemalt:~$ php -dxdebug.var_display_max_depth=6 /tmp/goo.php
/tmp/goo.php:10:
class Exception#1 (8) {
protected $message =>
string(0) ""
private $string =>
string(0) ""
protected $code =>
int(0)
protected $file =>
string(12) "/tmp/goo.php"
protected $line =>
int(4)
private $trace =>
array(1) {
[0] =>
array(4) {
'file' =>
string(12) "/tmp/goo.php"
'line' =>
int(8)
'function' =>
string(7) "testFoo"
'args' =>
array(1) {
[0] =>
string(6) "foobar"
}
}
}
private $previous =>
NULL
public $xdebug_message =>
string(170) "
Exception: in /tmp/goo.php on line 4

Call Stack:
0.0006 384360 1. {main}() /tmp/goo.php:0
0.0006 384360 2. testFoo($bar = 'foobar') /tmp/goo.php:8
"
}
</pre>

Which looks correct to me?

PirateKing

2020-02-17 15:26

reporter   ~0005246

Sorry for the false issue (this is not related to Xdebug after all), further debugging showed that this was due to the new zend.exception_ignore_args INI directive which was added in PHP 7.4 : https://www.php.net/manual/en/migration74.other-changes.php

derick

2020-02-17 16:23

administrator   ~0005247

OK. Thanks for checking! I'll make sure to add a test so this won't get lost.

derick

2020-02-27 16:19

administrator   ~0005262

Closing this out - thanks for telling me what went wrong :-)

Issue History

Date Modified Username Field Change
2020-02-13 15:37 PirateKing New Issue
2020-02-13 15:37 PirateKing File Added: Screenshot from 2020-02-13 15-49-03.png
2020-02-13 15:37 PirateKing File Added: Screenshot from 2020-02-13 16-05-53.png
2020-02-13 15:49 derick Assigned To => derick
2020-02-13 15:49 derick Status new => feedback
2020-02-13 15:49 derick Note Added: 0005242
2020-02-13 16:08 PirateKing Note Added: 0005243
2020-02-13 16:08 PirateKing Status feedback => assigned
2020-02-14 18:36 derick Note Added: 0005245
2020-02-17 15:26 PirateKing Note Added: 0005246
2020-02-17 16:23 derick Note Added: 0005247
2020-02-27 16:19 derick Status assigned => resolved
2020-02-27 16:19 derick Resolution open => no change required
2020-02-27 16:19 derick Note Added: 0005262