[wp-trac] [WordPress Trac] #33580: Having xdebug enabled causes wordpress tests to hang because bootstrap.php calls php directly using system()

WordPress Trac noreply at wordpress.org
Fri Aug 28 18:39:00 UTC 2015


#33580: Having xdebug enabled causes wordpress tests to hang because bootstrap.php
calls php directly using system()
---------------------------------------+------------------------------
 Reporter:  aussieguy123               |       Owner:
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:  Awaiting Review
Component:  Build/Test Tools           |     Version:
 Severity:  normal                     |  Resolution:
 Keywords:  needs-patch needs-testing  |     Focuses:
---------------------------------------+------------------------------
Changes (by johnbillion):

 * keywords:   => needs-patch needs-testing
 * version:  trunk =>


Old description:

> In wp-tests/tests/phpunit/includes/bootstrap.php there is this line:
> system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) .
> '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' .
> $multisite);
>
> To reproduce the bug, make sure xdebug.remote_enable=1and that xdebug is
> configured to connect back to your ide (xdebug.remote_connect_back=1
> xdebug.remote_host=x.x.x.x).
>
> When this system line is called from phpunit and you have xdebug
> listening in your IDE (I use PHPStorm), phpunit will hang.
>
> I'm not sure what happens internally with xdebug to cause this, its
> possible that the php process spawned by system() conflicts with the
> previous one. You only get the error if the IDE is listening.
>
> To fix this issue, I've made a simple change locally, updating the system
> call to:
> system( WP_PHP_BINARY . ' -d xdebug.remote_enable=0' . escapeshellarg(
> dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg(
> $config_file_path ) . ' ' . $multisite);
>
> This disables xdebug in the process spawned by system(). I can have
> xdebug enabled and I get no errors and set breakpoints in my tests.
>
> Should I make a patch with my fix or does someone have a better way?

New description:

 In wp-tests/tests/phpunit/includes/bootstrap.php there is this line:

 {{{
 system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) .
 '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' .
 $multisite);
 }}}

 To reproduce the bug, make sure `xdebug.remote_enable=1` and that xdebug
 is configured to connect back to your ide (`xdebug.remote_connect_back=1`
 `xdebug.remote_host=x.x.x.x`).

 When this system line is called from phpunit and you have xdebug listening
 in your IDE (I use PHPStorm), phpunit will hang.

 I'm not sure what happens internally with xdebug to cause this, its
 possible that the php process spawned by system() conflicts with the
 previous one. You only get the error if the IDE is listening.

 To fix this issue, I've made a simple change locally, updating the system
 call to:

 {{{
 system( WP_PHP_BINARY . ' -d xdebug.remote_enable=0' . escapeshellarg(
 dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg(
 $config_file_path ) . ' ' . $multisite);
 }}}

 This disables xdebug in the process spawned by system(). I can have xdebug
 enabled and I get no errors and set breakpoints in my tests.

 Should I make a patch with my fix or does someone have a better way?

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33580#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list