Infinite recursion in phpunit, using xdebug while Idea is running

I am evaluating Idea/Ultimate as an IDE for my php/perl development. I run the IDE on a Windows 7 Pro host, with the target system running on a CentOS guest. I have configured xdebug and remote debugging, and almost everything is running seamlessly. Tests are run from the command line on a shell running on the guest.

I am experiencing an issue with a specific set of phpunit tests. These run fine while the IDE is closed. If the IDE is open, these tests hang.

When I set a breakpoint in the IDE and attempt to step into the tests to diagnose the issue, I see what appears to be an infinite recursion during phpunit startup. These complaints are only visible while attempting to step into the code.

Here is a typical complaint (I've elided the several hundred repetitions of the last line):

[appuser@localhost phpunit]$ phpunit -c dev-env_mine.xml gateway/router/
PHPUnit 5.7.21 by Sebastian Bergmann and contributors.


Fatal error: Maximum function nesting level of '256' reached, aborting! in phar:///usr/bin/phpunit/phpunit/Util/GlobalState.php on line 201

Call Stack:
0.0076 406280 1. {main}() /usr/bin/phpunit:0
0.1635 13785272 2. PHPUnit_TextUI_Command::main(???) /usr/bin/phpunit:588
0.1635 13786008 3. PHPUnit_TextUI_Command->run(???, ???) phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:116
7.0655 18831944 4. PHPUnit_TextUI_TestRunner->doRun(???, ???, ???) phar:///usr/bin/phpunit/phpunit/TextUI/Command.php:186
11.4224 18850184 5. PHPUnit_Framework_TestSuite->run(???) phar:///usr/bin/phpunit/phpunit/TextUI/TestRunner.php:517
15.7024 18855160 6. PHPUnit_Framework_TestSuite->run(???) phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php:722
15.7076 18859240 7. PHPUnit_Framework_TestCase->run(???) phar:///usr/bin/phpunit/phpunit/Framework/TestSuite.php:722
15.7085 18864056 8. PHPUnit_Util_GlobalState::getGlobalsAsString() phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php:775
15.7093 18943472 9. PHPUnit_Util_GlobalState::exportVariable(???) phar:///usr/bin/phpunit/phpunit/Util/GlobalState.php:156
15.7093 18943472 10. PHPUnit_Util_GlobalState::arrayOnlyContainsScalars(???) phar:///usr/bin/phpunit/phpunit/Util/GlobalState.php:182
15.7093 18943880 11. PHPUnit_Util_GlobalState::arrayOnlyContainsScalars(???) phar:///usr/bin/phpunit/phpunit/Util/GlobalState.php:202
15.7094 18943976 12. PHPUnit_Util_GlobalState::arrayOnlyContainsScalars(???) phar:///usr/bin/phpunit/phpunit/Util/GlobalState.php:202
...

Any ideas/suggestions?

0
Avatar
Permanently deleted user

Hello,

Is there anything in the PhpStorm logs (Help > Show Log in ...)?

It is also worth to enable Xdebug logging and check it too.

 

0
Avatar
Permanently deleted user

1. I didn't intend this comment to go in the "PHPStorm" area. I'm using IDEA/Ultimate (with php plugins).

2. I'm keeping the logs, but they aren't helpful.

3. I've narrowed this down to specific code within phpunit/IDEA. The code was failing while phpunit was attempting to handle IDE_EVAL_CACHE global variable. I've just now updated to build #IU-172.3968.16, built on 21-Aug-2017. The attempt to get the global state (GlobalState::getGlobalsAsString) no longer attempts to get IDE_EVAL_CACHE, and the recursion no longer occurs.

It seems that this aspect of my issue is resolved.

0
Avatar
Permanently deleted user

Bummer. Not resolved, just changed.

The infinite recursion remains, and appears to happen while PHPUnit_Util_GlobalState::arrayOnlyContainsScalars is trying handle $_SERVER.

The attached screenshot shows the value of the $element (the array causing the apparently infinite recursion). Note that it includes a binding whose key is "IDE_EVAL_CACHE", an array with 451 elements. Each of those is itself an array being passed recursively, and I suspect that's the loop that needs to be broken.

 

0
Avatar
Permanently deleted user

Well, I found what appears to be a workaround. It's a hack.

For whatever reason, the IDE was halting because phpunit is calling itself with an argv of ["-"] -- who knows why. The IDE couldn't find a mapping for the file/directory whose name was "-". I was getting this infinite recursion while trying to sort out that issue.

The workaround is that I added a mapping for "-" in the local directory. The recursion is avoided, and the test suite now runs without issue. Screenshot of my mapping is below.

 

1

请先登录再写评论。