1
0
Fork 0

Clear xdebug version if restart fails, fixes #5995

pull/5999/head
johnstevenson 2016-12-27 18:44:20 +00:00
parent 2782d37a15
commit 2b8ad7dc2a
2 changed files with 24 additions and 0 deletions

View File

@ -79,6 +79,11 @@ class XdebugHandler
putenv('PHP_INI_SCAN_DIR');
}
}
// Clear version if the restart failed to disable xdebug
if ($this->loaded) {
putenv(self::ENV_VERSION);
}
}
}

View File

@ -113,6 +113,12 @@ class XdebugHandlerTest extends \PHPUnit_Framework_TestCase
$xdebug = new XdebugHandlerMock($loaded);
$xdebug->check();
$this->assertEquals($xdebug->testVersion, getenv(XdebugHandlerMock::ENV_VERSION));
// Mimic successful restart
$loaded = false;
$xdebug = new XdebugHandlerMock($loaded);
$xdebug->check();
$this->assertEquals($xdebug->testVersion, getenv(XdebugHandlerMock::ENV_VERSION));
}
public function testEnvVersionWhenNotLoaded()
@ -124,6 +130,19 @@ class XdebugHandlerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(false, getenv(XdebugHandlerMock::ENV_VERSION));
}
public function testEnvVersionWhenRestartFails()
{
$loaded = true;
$xdebug = new XdebugHandlerMock($loaded);
$xdebug->check();
// Mimic failed restart
$xdebug = new XdebugHandlerMock($loaded);
$xdebug->check();
$this->assertEquals(false, getenv(XdebugHandlerMock::ENV_VERSION));
}
public static function setUpBeforeClass()
{
// Save current state