Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b24a338

Browse files
Merge branch '3.3' into 3.4
* 3.3: [Profiler] Fix data collector getCasters() call remove symfony/process suggestion [DI] Remove unused dynamic property [Process] Fixed issue between process builder and exec non-conflicting anonymous service ids across files
2 parents de5c60d + de1143b commit b24a338

File tree

10 files changed

+48
-19
lines changed

10 files changed

+48
-19
lines changed

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
"symfony/validator": "For using validation",
8181
"symfony/yaml": "For using the debug:config and lint:yaml commands",
8282
"symfony/property-info": "For using the property_info service",
83-
"symfony/process": "For using the server:run, server:start, server:stop, and server:status commands",
8483
"symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering"
8584
},
8685
"autoload": {

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public function dump(array $options = array())
120120
'debug' => true,
121121
), $options);
122122

123-
$this->classResources = array();
124123
$this->initializeMethodNamesMap($options['base_class']);
125124

126125
$this->docStar = $options['debug'] ? '*' : '';

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ public function load($resource, $type = null)
121121
// parameters
122122
if (isset($content['parameters'])) {
123123
if (!is_array($content['parameters'])) {
124-
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $resource));
124+
throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $path));
125125
}
126126

127127
foreach ($content['parameters'] as $key => $value) {
128-
$this->container->setParameter($key, $this->resolveServices($value, $resource, true));
128+
$this->container->setParameter($key, $this->resolveServices($value, $path, true));
129129
}
130130
}
131131

@@ -136,7 +136,7 @@ public function load($resource, $type = null)
136136
$this->anonymousServicesCount = 0;
137137
$this->setCurrentDir(dirname($path));
138138
try {
139-
$this->parseDefinitions($content, $resource);
139+
$this->parseDefinitions($content, $path);
140140
} finally {
141141
$this->instanceof = array();
142142
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
services:
2+
AppBundle\Foo:
3+
arguments:
4+
- !service {class: AppBundle\Bar }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
services:
2+
AppBundle\Hello:
3+
arguments:
4+
- !service {class: AppBundle\World}

src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public function testDecoratedServicesWithWrongSyntaxThrowsException()
501501

502502
/**
503503
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
504-
* @expectedExceptionMessage Parameter "tags" must be an array for service "Foo\Bar" in services31_invalid_tags.yml. Check your YAML syntax.
504+
* @expectedExceptionMessageRegExp /Parameter "tags" must be an array for service "Foo\\Bar" in .+services31_invalid_tags\.yml\. Check your YAML syntax./
505505
*/
506506
public function testInvalidTagsWithDefaults()
507507
{
@@ -534,7 +534,7 @@ public function testAnonymousServices()
534534
$this->assertCount(1, $args);
535535
$this->assertInstanceOf(Reference::class, $args[0]);
536536
$this->assertTrue($container->has((string) $args[0]));
537-
$this->assertStringStartsWith('2', (string) $args[0]);
537+
$this->assertRegExp('/^\d+_[A-Za-z0-9]{64}$/', (string) $args[0]);
538538

539539
$anonymous = $container->getDefinition((string) $args[0]);
540540
$this->assertEquals('Bar', $anonymous->getClass());
@@ -546,7 +546,7 @@ public function testAnonymousServices()
546546
$this->assertInternalType('array', $factory);
547547
$this->assertInstanceOf(Reference::class, $factory[0]);
548548
$this->assertTrue($container->has((string) $factory[0]));
549-
$this->assertStringStartsWith('1', (string) $factory[0]);
549+
$this->assertRegExp('/^\d+_[A-Za-z0-9]{64}$/', (string) $factory[0]);
550550
$this->assertEquals('constructFoo', $factory[1]);
551551

552552
$anonymous = $container->getDefinition((string) $factory[0]);
@@ -555,6 +555,19 @@ public function testAnonymousServices()
555555
$this->assertFalse($anonymous->isAutowired());
556556
}
557557

558+
public function testAnonymousServicesInDifferentFilesWithSameNameDoNotConflict()
559+
{
560+
$container = new ContainerBuilder();
561+
562+
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml/foo'));
563+
$loader->load('services.yml');
564+
565+
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml/bar'));
566+
$loader->load('services.yml');
567+
568+
$this->assertCount(5, $container->getDefinitions());
569+
}
570+
558571
public function testAnonymousServicesInInstanceof()
559572
{
560573
$container = new ContainerBuilder();
@@ -582,7 +595,7 @@ public function testAnonymousServicesInInstanceof()
582595

583596
/**
584597
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
585-
* @expectedExceptionMessage Creating an alias using the tag "!service" is not allowed in "anonymous_services_alias.yml".
598+
* @expectedExceptionMessageRegExp /Creating an alias using the tag "!service" is not allowed in ".+anonymous_services_alias\.yml"\./
586599
*/
587600
public function testAnonymousServicesWithAliases()
588601
{
@@ -593,7 +606,7 @@ public function testAnonymousServicesWithAliases()
593606

594607
/**
595608
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
596-
* @expectedExceptionMessage Using an anonymous service in a parameter is not allowed in "anonymous_services_in_parameters.yml".
609+
* @expectedExceptionMessageRegExp /Using an anonymous service in a parameter is not allowed in ".+anonymous_services_in_parameters\.yml"\./
597610
*/
598611
public function testAnonymousServicesInParameters()
599612
{
@@ -614,7 +627,7 @@ public function testAutoConfigureInstanceof()
614627

615628
/**
616629
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
617-
* @expectedExceptionMessage Service "_defaults" key must be an array, "NULL" given in "bad_empty_defaults.yml".
630+
* @expectedExceptionMessageRegExp /Service "_defaults" key must be an array, "NULL" given in ".+bad_empty_defaults\.yml"\./
618631
*/
619632
public function testEmptyDefaultsThrowsClearException()
620633
{
@@ -625,7 +638,7 @@ public function testEmptyDefaultsThrowsClearException()
625638

626639
/**
627640
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
628-
* @expectedExceptionMessage Service "_instanceof" key must be an array, "NULL" given in "bad_empty_instanceof.yml".
641+
* @expectedExceptionMessageRegExp /Service "_instanceof" key must be an array, "NULL" given in ".+bad_empty_instanceof\.yml"\./
629642
*/
630643
public function testEmptyInstanceofThrowsClearException()
631644
{

src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
19-
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
2019
use Symfony\Component\Validator\ConstraintViolationInterface;
2120
use Symfony\Component\VarDumper\Caster\Caster;
2221
use Symfony\Component\VarDumper\Caster\ClassStub;
@@ -68,11 +67,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
6867
*/
6968
private $formsByView;
7069

71-
/**
72-
* @var ValueExporter
73-
*/
74-
private $valueExporter;
75-
7670
private $hasVarDumper;
7771

7872
public function __construct(FormDataExtractorInterface $dataExtractor)

src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function cloneVar($var)
6969
if (class_exists(CutStub::class)) {
7070
$this->cloner = new VarCloner();
7171
$this->cloner->setMaxItems(-1);
72-
$this->cloner->addCasters(self::getCasters());
72+
$this->cloner->addCasters($this->getCasters());
7373
} else {
7474
@trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since version 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED);
7575
$this->cloner = false;

src/Symfony/Component/Process/ProcessBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ public function getProcess()
268268

269269
$arguments = array_merge($this->prefix, $this->arguments);
270270
$process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options);
271+
// to preserve the BC with symfony <3.3, we convert the array structure
272+
// to a string structure to avoid the prefixing with the exec command
273+
$process->setCommandLine($process->getCommandLine());
271274

272275
if ($this->inheritEnv) {
273276
$process->inheritEnvironmentVariables();

src/Symfony/Component/Process/Tests/ProcessBuilderTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,17 @@ public function testInvalidInput()
210210
$builder = ProcessBuilder::create();
211211
$builder->setInput(array());
212212
}
213+
214+
public function testDoesNotPrefixExec()
215+
{
216+
if ('\\' === DIRECTORY_SEPARATOR) {
217+
$this->markTestSkipped('This test cannot run on Windows.');
218+
}
219+
220+
$builder = ProcessBuilder::create(array('command', '-v', 'ls'));
221+
$process = $builder->getProcess();
222+
$process->run();
223+
224+
$this->assertTrue($process->isSuccessful());
225+
}
213226
}

0 commit comments

Comments
 (0)