8000 Merge branch '3.3' into 3.4 · dunglas/symfony@cc027a2 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit cc027a2

Browse files
Merge branch '3.3' into 3.4
* 3.3: Add application/ld+json format associated to json [HttpFoundation] Fix false-positive ConflictingHeadersException [WebServerBundle] Fix escaping of php binary with arguments Error handlers' $context should be optional as it's deprecated [Serializer] Correct typing mistake in DocBlock [Config] Fix closure CS PHP CS Fixer: use PHPUnit Migration ruleset Update MemcachedTrait.php [Bridge/PhpUnit] thank phpunit/phpunit [Process] Fix setting empty env vars [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions [WebServerBundle] fix a bug where require would not require the good file because of env [Console] Commands with an alias should not be recognized as ambiguous
2 parents 61fc5f7 + 770e515 commit cc027a2

File tree

20 files changed

+111
-25
lines changed

20 files changed

+111
-25
lines changed

.php_cs.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ return PhpCsFixer\Config::create()
88
->setRules(array(
99
'@Symfony' => true,
1010
'@Symfony:risky' => true,
11+
'@PHPUnit48Migration:risky' => true,
12+
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
1113
'array_syntax' => array('syntax' => 'long'),
1214
'protected_to_private' => false,
13-
'php_unit_dedicate_assert' => array('target' => '3.5'),
1415
))
1516
->setRiskyAllowed(true)
1617
->setFinder(

src/Symfony/Bridge/PhpUnit/composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"extra": {
4242
"branch-alias": {
4343
"dev-master": "3.4-dev"
44+
},
45+
"thanks": {
46+
"name": "phpunit/phpunit",
47+
"url": "https://github.com/sebastianbergmann/phpunit"
4448
}
4549
}
4650
}

src/Symfony/Bundle/WebServerBundle/Resources/router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
return false;
3131
}
3232

33-
$script = getenv('APP_FRONT_CONTROLLER') ?: 'index.php';
33+
$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php';
3434

3535
$_SERVER = array_merge($_SERVER, $_ENV);
3636
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script;

src/Symfony/Bundle/WebServerBundle/WebServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ public function isRunning($pidFile = null)
146146
private function createServerProcess(WebServerConfig $config)
147147
{
148148
$finder = new PhpExecutableFinder();
149-
if (false === $binary = $finder->find()) {
149+
if (false === $binary = $finder->find(false)) {
150150
throw new \RuntimeException('Unable to find the PHP binary.');
151151
}
152152

153-
$process = new Process(array($binary, '-S', $config->getAddress(), $config->getRouter()));
153+
$process = new Process(array_merge(array($binary), $finder->findArguments(), array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
154154
$process->setWorkingDirectory($config->getDocumentRoot());
155155
$process->setTimeout(null);
156156

src/Symfony/Bundle/WebServerBundle/WebServerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct($documentRoot, $env, $address = null, $router = null
3232
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env))));
3333
}
3434

35-
putenv('APP_FRONT_CONTROLLER='.$file);
35+
$_ENV['APP_FRONT_CONTROLLER'] = $file;
3636

3737
$this->documentRoot = $documentRoot;
3838
$this->env = $env;

src/Symfony/Bundle/WebServerBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"symfony/console": "~3.4|~4.0",
2222
"symfony/dependency-injection": "~3.4|~4.0",
2323
"symfony/http-kernel": "~3.3|~4.0",
24-
"symfony/process": "~3.3|~4.0"
24+
"symfony/process": "~3.3.14|^3.4.2|^4.0.2"
2525
},
2626
"autoload": {
2727
"psr-4": { "Symfony\\Bundle\\WebServerBundle\\": "" },

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function init(\Memcached $client, $namespace, $defaultLifetime)
7171
*
7272
* @return \Memcached
7373
*
74-
* @throws \ErrorEception When invalid options or servers are provided
74+
* @throws \ErrorException When invalid options or servers are provided
7575
*/
7676
public static function createConnection($servers, array $options = array())
7777
{

src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function thenEmptyArray()
186186
*/
187187
public function thenInvalid($message)
188188
{
189-
$this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };
189+
$this->thenPart = function ($v) use ($message) { throw new \InvalidArgumentException(sprintf($message, json_encode($v))); };
190190

191191
return $this;
192192
}

src/Symfony/Component/Config/ResourceCheckerConfigCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function safelyUnserialize($file)
158158
$meta = false;
159159
$signalingException = new \UnexpectedValueException();
160160
$prevUnserializeHandler = ini_set('unserialize_callback_func', '');
161-
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) use (&$prevErrorHandler, $signalingException) {
161+
$prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$prevErrorHandler, $signalingException) {
162162
if (E_WARNING === $type && 'Class __PHP_Incomplete_Class has no unserializer' === $msg) {
163163
throw $signalingException;
164164
}

src/Symfony/Component/Console/Application.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ public function find($name)
580580
{
581581
$this->init();
582582

583+
$aliases = array();
583584
$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
584585
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
585586
$commands = preg_grep('{^'.$expr.'}', $allCommands);
@@ -612,14 +613,15 @@ public function find($name)
612613
// filter out aliases for commands which are already on the list
613614
if (count($commands) > 1) {
614615
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
615-
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
616+
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
616617
$commandName = $commandList[$nameOrAlias] instanceof Command ? $commandList[$nameOrAlias]->getName() : $nameOrAlias;
618+
$aliases[$nameOrAlias] = $commandName;
617619

618620
return $commandName === $nameOrAlias || !in_array($commandName, $commands);
619621
}));
620622
}
621623

622-
$exact = in_array($name, $commands, true);
624+
$exact = in_array($name, $commands, true) || isset($aliases[$name]);
623625
if (count($commands) > 1 && !$exact) {
624626
$usableWidth = $this->terminal->getWidth() - 10;
625627
$abbrevs = array_values($commands);

0 commit comments

Comments
 (0)
0