1
0
Fork 0

Merge branch '1.3'

pull/6018/head
Jordi Boggiano 2016-12-31 16:35:19 +01:00
commit a1eb1ab604
6 changed files with 62 additions and 114 deletions

View File

@ -41,9 +41,9 @@ if (function_exists('ini_set')) {
}; };
$memoryLimit = trim(ini_get('memory_limit')); $memoryLimit = trim(ini_get('memory_limit'));
// Increase memory_limit if it is lower than 1GB // Increase memory_limit if it is lower than 1.5GB
if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) { if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
@ini_set('memory_limit', '1G'); @ini_set('memory_limit', '1536M');
} }
unset($memoryInBytes, $memoryLimit); unset($memoryInBytes, $memoryLimit);
} }

56
composer.lock generated
View File

@ -189,16 +189,16 @@
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",
"version": "4.0.1", "version": "4.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/justinrainbow/json-schema.git", "url": "https://github.com/justinrainbow/json-schema.git",
"reference": "10d1f6977f6be5f177dded8f585a11debdc27591" "reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/10d1f6977f6be5f177dded8f585a11debdc27591", "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/d39c56a46b3ebe1f3696479966cd2b9f50aaa24f",
"reference": "10d1f6977f6be5f177dded8f585a11debdc27591", "reference": "d39c56a46b3ebe1f3696479966cd2b9f50aaa24f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -251,7 +251,7 @@
"json", "json",
"schema" "schema"
], ],
"time": "2016-11-09T16:32:33+00:00" "time": "2016-12-22T16:43:46+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -440,16 +440,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e" "reference": "d5643cd095e5e37d31e004bb2606b5dd7e96602f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a871ba00e0f604dceac64c56c27f99fbeaf4854e", "url": "https://api.github.com/repos/symfony/console/zipball/d5643cd095e5e37d31e004bb2606b5dd7e96602f",
"reference": "a871ba00e0f604dceac64c56c27f99fbeaf4854e", "reference": "d5643cd095e5e37d31e004bb2606b5dd7e96602f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -497,11 +497,11 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-11-15T23:02:12+00:00" "time": "2016-12-06T11:59:35+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
@ -558,7 +558,7 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
@ -607,16 +607,16 @@
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd" "reference": "c0f10576335743b881ac1ed39d18c0fa66048775"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/0023b024363dfc0cd21262e556f25a291fe8d7fd", "url": "https://api.github.com/repos/symfony/finder/zipball/c0f10576335743b881ac1ed39d18c0fa66048775",
"reference": "0023b024363dfc0cd21262e556f25a291fe8d7fd", "reference": "c0f10576335743b881ac1ed39d18c0fa66048775",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -652,7 +652,7 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-11-03T07:52:58+00:00" "time": "2016-12-13T09:38:12+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -715,16 +715,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f" "reference": "1a1bd056395540d0bc549d39818316513565d278"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f", "url": "https://api.github.com/repos/symfony/process/zipball/1a1bd056395540d0bc549d39818316513565d278",
"reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f", "reference": "1a1bd056395540d0bc549d39818316513565d278",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -760,7 +760,7 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-09-29T14:03:54+00:00" "time": "2016-11-24T00:43:03+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@ -1175,16 +1175,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.8.30", "version": "4.8.31",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a534e04d0bd39c557c2881c341efd06fa6f1292a" "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a534e04d0bd39c557c2881c341efd06fa6f1292a", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/98b2b39a520766bec663ff5b7ff1b729db9dbfe3",
"reference": "a534e04d0bd39c557c2881c341efd06fa6f1292a", "reference": "98b2b39a520766bec663ff5b7ff1b729db9dbfe3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1243,7 +1243,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-12-01T17:05:48+00:00" "time": "2016-12-09T02:45:31+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@ -1675,7 +1675,7 @@
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.8.14", "version": "v2.8.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",

View File

@ -121,7 +121,7 @@ class RepositoryFactory
$rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('fossil', 'Composer\Repository\FossilRepository'); $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository'); $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository'); $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');

View File

@ -237,7 +237,8 @@ class Git
$authFailures = array( $authFailures = array(
'fatal: Authentication failed', 'fatal: Authentication failed',
'remote error: Invalid username or password.', 'remote error: Invalid username or password.',
'error: 401 Unauthorized' 'error: 401 Unauthorized',
'fatal: unable to access'
); );
foreach ($authFailures as $authFailure) { foreach ($authFailures as $authFailure) {

View File

@ -28,7 +28,7 @@ class IniHelper
* *
* The equivalent of calling php_ini_loaded_file then php_ini_scanned_files. * The equivalent of calling php_ini_loaded_file then php_ini_scanned_files.
* The loaded ini location is the first entry and may be empty. * The loaded ini location is the first entry and may be empty.
*
* @return array * @return array
*/ */
public static function getAll() public static function getAll()

View File

@ -136,9 +136,13 @@ class XdebugHandler
{ {
$this->tmpIni = ''; $this->tmpIni = '';
$iniPaths = IniHelper::getAll(); $iniPaths = IniHelper::getAll();
$files = $this->getWorkingSet($iniPaths, $replace);
if ($this->writeTmpIni($files, $replace)) { if (empty($iniPaths[0])) {
// There is no loaded ini
array_shift($iniPaths);
}
if ($this->writeTmpIni($iniPaths)) {
return $this->setEnvironment($iniPaths); return $this->setEnvironment($iniPaths);
} }
@ -151,24 +155,21 @@ class XdebugHandler
* The filename is passed as the -c option when the process restarts. * The filename is passed as the -c option when the process restarts.
* *
* @param array $iniFiles The php.ini locations * @param array $iniFiles The php.ini locations
* @param bool $replace Whether the files need modifying
* *
* @return bool * @return bool
*/ */
private function writeTmpIni(array $iniFiles, $replace) private function writeTmpIni(array $iniFiles)
{ {
if (empty($iniFiles)) {
// Unlikely, maybe xdebug was loaded through a command line option.
return true;
}
if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) { if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
return false; return false;
} }
$content = ''; $content = '';
$regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
foreach ($iniFiles as $file) { foreach ($iniFiles as $file) {
$content .= $this->getIniData($file, $replace); $data = preg_replace($regex, ';$1', file_get_contents($file));
$content .= $data.PHP_EOL;
} }
$content .= PHP_EOL.'memory_limit='.ini_get('memory_limit').PHP_EOL; $content .= PHP_EOL.'memory_limit='.ini_get('memory_limit').PHP_EOL;
@ -176,60 +177,6 @@ class XdebugHandler
return @file_put_contents($this->tmpIni, $content); return @file_put_contents($this->tmpIni, $content);
} }
/**
* Returns an array of ini files to use
*
* @param array $iniPaths Locations used by the current prcoess
* @param null|bool $replace Whether the files need modifying, set by method
*
* @return array
*/
private function getWorkingSet(array $iniPaths, &$replace)
{
$replace = true;
$result = array();
if (empty($iniPaths[0])) {
// There is no loaded ini
array_shift($iniPaths);
}
foreach ($iniPaths as $file) {
if (preg_match('/xdebug.ini$/', $file)) {
// Skip the file, no need for regex replacing
$replace = false;
} else {
$result[] = $file;
}
}
return $result;
}
/**
* Returns formatted ini file data
*
* @param string $iniFile The location of the ini file
* @param bool $replace Whether to regex replace content
*
* @return string The ini data
*/
private function getIniData($iniFile, $replace)
{
$contents = file_get_contents($iniFile);
$data = PHP_EOL;
if ($replace) {
// Comment out xdebug config
$regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
$data .= preg_replace($regex, ';$1', $contents);
} else {
$data .= $contents;
}
return $data;
}
/** /**
* Returns the restart command line * Returns the restart command line
* *