|
@@ -139,11 +139,6 @@ class XdebugHandler
|
|
|
$iniPaths = IniHelper::getAll();
|
|
|
$additional = count($iniPaths) > 1;
|
|
|
|
|
|
- if (empty($iniPaths[0])) {
|
|
|
- // There is no loaded ini
|
|
|
- array_shift($iniPaths);
|
|
|
- }
|
|
|
-
|
|
|
if ($this->writeTmpIni($iniPaths)) {
|
|
|
return $this->setEnvironment($additional, $iniPaths);
|
|
|
}
|
|
@@ -156,20 +151,25 @@ class XdebugHandler
|
|
|
*
|
|
|
* The filename is passed as the -c option when the process restarts.
|
|
|
*
|
|
|
- * @param array $iniFiles The php.ini locations
|
|
|
+ * @param array $iniPaths Locations reported by the current process
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|
|
|
- private function writeTmpIni(array $iniFiles)
|
|
|
+ private function writeTmpIni(array $iniPaths)
|
|
|
{
|
|
|
if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ // $iniPaths has at least one item and it may be empty
|
|
|
+ if (empty($iniPaths[0])) {
|
|
|
+ array_shift($iniPaths);
|
|
|
+ }
|
|
|
+
|
|
|
$content = '';
|
|
|
$regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
|
|
|
|
|
|
- foreach ($iniFiles as $file) {
|
|
|
+ foreach ($iniPaths as $file) {
|
|
|
$data = preg_replace($regex, ';$1', file_get_contents($file));
|
|
|
$content .= $data.PHP_EOL;
|
|
|
}
|
|
@@ -203,7 +203,7 @@ class XdebugHandler
|
|
|
* Returns true if the restart environment variables were set
|
|
|
*
|
|
|
* @param bool $additional Whether there were additional inis
|
|
|
- * @param array $iniPaths Locations used by the current prcoess
|
|
|
+ * @param array $iniPaths Locations reported by the current process
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|