Clear xdebug version if restart fails, fixes #5995
parent
2782d37a15
commit
2b8ad7dc2a
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue