Skip to content

Commit a36fb54

Browse files
Merge branch '3.4'
* 3.4: (26 commits) [Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit [Console] Fix disabling lazy commands [DI] Remove scalar typehint in class used in test case Remove the `server:log` command if monolog is not loaded [SecurityBundle] Fix syntax error in test [Console] Remove remaining dead code Throw on service:method factory notation in PHP-based DI configuration Test that named arguments are prioritized over typehinted bumped Symfony version to 3.3.14 bumped Symfony version to 2.8.32 bumped Symfony version to 2.7.39 Prove that change is working with tests updated VERSION for 3.3.13 updated CHANGELOG for 3.3.13 updated VERSION for 2.8.31 updated CHANGELOG for 2.8.31 updated VERSION for 2.7.38 updated CHANGELOG for 2.7.38 Replace array|\Traversable by iterable [DI] Fix by-type args injection ...
2 parents 422c446 + e40905a commit a36fb54

File tree

32 files changed

+433
-97
lines changed

32 files changed

+433
-97
lines changed

CHANGELOG-3.3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ in 3.3 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1
99

10+
* 3.3.13 (2017-11-16)
11+
12+
* security #24995 Validate redirect targets using the session cookie domain (nicolas-grekas)
13+
* security #24994 Prevent bundle readers from breaking out of paths (xabbuh)
14+
* security #24993 Ensure that submitted data are uploaded files (xabbuh)
15+
* security #24992 Namespace generated CSRF tokens depending of the current scheme (dunglas)
16+
1017
* 3.3.12 (2017-11-13)
1118

1219
* bug #24954 [DI] Fix dumping with custom base class (nicolas-grekas)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\PhpUnit;
13+
14+
/**
15+
* Utility class replacing PHPUnit's implementation of the same class.
16+
*
17+
* All files are blacklisted so that process-isolated tests don't start with broken
18+
* "require_once" statements. Composer is the only supported way to load code there.
19+
*/
20+
class Blacklist
21+
{
22+
public static $blacklistedClassNames = array();
23+
24+
public function getBlacklistedDirectories()
25+
{
26+
$root = dirname(__DIR__);
27+
while ($root !== $parent = dirname($root)) {
28+
$root = $parent;
29+
}
30+
31+
return array($root);
32+
}
33+
34+
public function isBlacklisted($file)
35+
{
36+
return true;
37+
}
38+
}
39+
40+
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit\Util\Blacklist');
41+
class_alias('Symfony\Bridge\PhpUnit\Blacklist', 'PHPUnit_Util_Blacklist');

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use PHPUnit\Framework\AssertionFailedError;
1616
use PHPUnit\Framework\TestCase;
1717
use PHPUnit\Framework\TestSuite;
18-
use PHPUnit\Util\Blacklist;
1918
use Symfony\Bridge\PhpUnit\ClockMock;
2019
use Symfony\Bridge\PhpUnit\DnsMock;
2120

@@ -46,17 +45,6 @@ class SymfonyTestsListenerTrait
4645
*/
4746
public function __construct(array $mockedNamespaces = array())
4847
{
49-
if (class_exists('PHPUnit_Util_Blacklist')) {
50-
\PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\DeprecationErrorHandler'] = 1;
51-
\PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\SymfonyTestsListener'] = 1;
52-
\PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'] = 1;
53-
\PHPUnit_Util_Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 1;
54-
} else {
55-
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\DeprecationErrorHandler'] = 1;
56-
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\SymfonyTestsListener'] = 1;
57-
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 1;
58-
}
59-
6048
foreach ($mockedNamespaces as $type => $namespaces) {
6149
if (!is_array($namespaces)) {
6250
$namespaces = array($namespaces);
@@ -94,7 +82,7 @@ public function globalListenerDisabled()
9482

9583
public function startTestSuite($suite)
9684
{
97-
if (class_exists('PHPUnit_Util_Blacklist', false)) {
85+
if (class_exists('PHPUnit_Util_Test', false)) {
9886
$Test = 'PHPUnit_Util_Test';
9987
} else {
10088
$Test = 'PHPUnit\Util\Test';
@@ -181,7 +169,7 @@ public function startTest($test)
181169
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$this->runsInSeparateProcess);
182170
}
183171

184-
if (class_exists('PHPUnit_Util_Blacklist', false)) {
172+
if (class_exists('PHPUnit_Util_Test', false)) {
185173
$Test = 'PHPUnit_Util_Test';
186174
$AssertionFailedError = 'PHPUnit_Framework_AssertionFailedError';
187175
} else {
@@ -227,7 +215,7 @@ public function addWarning($test, $e, $time)
227215

228216
public function endTest($test, $time)
229217
{
230-
if (class_exists('PHPUnit_Util_Blacklist', false)) {
218+
if (class_exists('PHPUnit_Util_Test', false)) {
231219
$Test = 'PHPUnit_Util_Test';
232220
$BaseTestRunner = 'PHPUnit_Runner_BaseTestRunner';
233221
$Warning = 'PHPUnit_Framework_Warning';

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
8282
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
8383
require PHPUNIT_COMPOSER_INSTALL;
8484
85-
if (!class_exists('SymfonyBlacklistPhpunit', false)) {
86-
class SymfonyBlacklistPhpunit {}
87-
}
88-
if (class_exists('PHPUnit_Util_Blacklist')) {
89-
PHPUnit_Util_Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
90-
PHPUnit_Util_Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;
91-
} else {
92-
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
93-
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;
94-
}
95-
9685
Symfony\Bridge\PhpUnit\TextUI\Command::main();
9786

9887
EOPHP
@@ -211,9 +200,6 @@ if ($components) {
211200
}
212201
}
213202
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
214-
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
215-
class SymfonyBlacklistSimplePhpunit {}
216-
}
217203
array_splice($argv, 1, 0, array('--colors=always'));
218204
$_SERVER['argv'] = $argv;
219205
$_SERVER['argc'] = ++$argc;

src/Symfony/Bridge/PhpUnit/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Doctrine\Common\Annotations\AnnotationRegistry;
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

15+
// Replace the native phpunit Blacklist, it's a broken artifact from the past
16+
require_once __DIR__.'/Blacklist.php';
17+
1518
// Detect if we need to serialize deprecations to a file.
1619
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
1720
DeprecationErrorHandler::collectDeprecations($file);

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
9191
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
9292
$this->cacheClearer->clear($realCacheDir);
9393

94+
// The current event dispatcher is stale, let's not use it anymore
95+
$this->getApplication()->setDispatcher(new EventDispatcher());
96+
9497
if ($input->getOption('no-warmup')) {
9598
$this->filesystem->rename($realCacheDir, $oldCacheDir);
9699
} else {
@@ -103,9 +106,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
103106

104107
$this->filesystem->remove($oldCacheDir);
105108

106-
// The current event dispatcher is stale, let's not use it anymore
107-
$this->getApplication()->setDispatcher(new EventDispatcher());
108-
109109
if ($output->isVerbose()) {
110110
$io->comment('Finished');
111111
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSessionDomainConstraintPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ private function createContainer($sessionStorageOptions)
126126
$ext = new SecurityExtension();
127127
$ext->load($config, $container);
128128

129-
(new AddSessionDomainConstraintPass())->process($container);
129+
$pass = new AddSessionDomainConstraintPass();
130+
$pass->process($container);
130131

131132
return $container;
132133
}

src/Symfony/Bundle/WebServerBundle/DependencyInjection/WebServerExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\WebServerBundle\DependencyInjection;
1313

14+
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
1415
use Symfony\Component\DependencyInjection\Extension\Extension;
1516
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -25,5 +26,9 @@ public function load(array $configs, ContainerBuilder $container)
2526
{
2627
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
2728
$loader->load('webserver.xml');
29+
30+
if (!class_exists(ConsoleFormatter::class)) {
31+
$container->removeDefinition('web_server.command.server_log');
32+
}
2833
}
2934
}

src/Symfony/Component/Console/Application.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -442,15 +442,12 @@ public function get($name)
442442
{
443443
$this->init();
444444

445-
if (isset($this->commands[$name])) {
446-
$command = $this->commands[$name];
447-
} elseif ($this->commandLoader && $this->commandLoader->has($name)) {
448-
$command = $this->commandLoader->get($name);
449-
$this->add($command);
450-
} else {
445+
if (!$this->has($name)) {
451446
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
452447
}
453448

449+
$command = $this->commands[$name];
450+
454451
if ($this->wantHelps) {
455452
$this->wantHelps = false;
456453

@@ -474,7 +471,7 @@ public function has($name)
474471
{
475472
$this->init();
476473

477-
return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name));
474+
return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
478475
}
479476

480477
/**
@@ -636,7 +633,7 @@ public function all($namespace = null)
636633

637634
$commands = $this->commands;
638635
foreach ($this->commandLoader->getNames() as $name) {
639-
if (!isset($commands[$name])) {
636+
if (!isset($commands[$name]) && $this->has($name)) {
640637
$commands[$name] = $this->get($name);
641638
}
642639
}
@@ -653,7 +650,7 @@ public function all($namespace = null)
653650

654651
if ($this->commandLoader) {
655652
foreach ($this->commandLoader->getNames() as $name) {
656-
if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
653+
if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
657654
$commands[$name] = $this->get($name);
658655
}
659656
}
@@ -957,8 +954,8 @@ public function extractNamespace($name, $limit = null)
957954
* Finds alternative of $name among $collection,
958955
* if nothing is found in $collection, try in $abbrevs.
959956
*
960-
* @param string $name The string
961-
* @param array|\Traversable $collection The collection
957+
* @param string $name The string
958+
* @param iterable $collection The collection
962959
*
963960
* @return string[] A sorted array of similar string
964961
*/

src/Symfony/Component/Console/Question/Question.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function setHiddenFallback($fallback)
117117
/**
118118
* Gets values for the autocompleter.
119119
*
120-
* @return null|array|\Traversable
120+
* @return null|iterable
121121
*/
122122
public function getAutocompleterValues()
123123
{
@@ -127,7 +127,7 @@ public function getAutocompleterValues()
127127
/**
128128
* Sets values for the autocompleter.
129129
*
130-
* @param null|array|\Traversable $values
130+
* @param null|iterable $values
131131
*
132132
* @return $this
133133
*

0 commit comments

Comments
 (0)