1
0
Fork 0

Merge remote-tracking branch 'johnstevenson/xdebug-#5995' into 1.3

pull/6001/merge
Jordi Boggiano 2016-12-28 17:44:45 +01:00
commit 6816acbe27
2 changed files with 24 additions and 0 deletions

View File

@ -79,6 +79,11 @@ class XdebugHandler
putenv('PHP_INI_SCAN_DIR'); 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 = new XdebugHandlerMock($loaded);
$xdebug->check(); $xdebug->check();
$this->assertEquals($xdebug->testVersion, getenv(XdebugHandlerMock::ENV_VERSION)); $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() public function testEnvVersionWhenNotLoaded()
@ -124,6 +130,19 @@ class XdebugHandlerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(false, getenv(XdebugHandlerMock::ENV_VERSION)); $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() public static function setUpBeforeClass()
{ {
// Save current state // Save current state