Skip to content

Commit 2f25e92

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Fix typo Fix deprecated libxml_disable_entity_loader Add Tagalog translations for validator messages 94, 95, 96 and 99 PHPUnit's assertContains() performs strict comparisons now. [ClassLoader][Routing] Fix namespace parsing on php 8. Fix deprecated libxml_disable_entity_loader Made reference to PHPUnit\Util\XML::loadfile php5-compatible. [Validator] Add missing translations for german and vietnamese Modernized deprecated PHPUnit assertion calls [Console] The message of "class not found" errors has changed in php 8. The PHPUnit\Util\XML class has been removed in PHPUnit 9.3. [Console] Make sure we pass a numeric array of arguments to call_user_func_array(). [Serializer] Fix that it will never reach DOMNode [Validator] sync translations [VarDumper] Improve previous fix on light array coloration [Cache] Fix #37667
2 parents c45c3f2 + 4c62edf commit 2f25e92

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

Loader/XmlFileLoader.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,13 @@ public function validateSchema(\DOMDocument $dom)
624624
EOF
625625
;
626626

627-
$disableEntities = libxml_disable_entity_loader(false);
628-
$valid = @$dom->schemaValidateSource($source);
629-
libxml_disable_entity_loader($disableEntities);
627+
if (LIBXML_VERSION < 20900) {
628+
$disableEntities = libxml_disable_entity_loader(false);
629+
$valid = @$dom->schemaValidateSource($source);
630+
libxml_disable_entity_loader($disableEntities);
631+
} else {
632+
$valid = @$dom->schemaValidateSource($source);
633+
}
630634

631635
foreach ($tmpfiles as $tmpfile) {
632636
@unlink($tmpfile);

Tests/Loader/FileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function testMissingParentClass()
207207

208208
$this->assertTrue($container->has(MissingParent::class));
209209

210-
$this->assertRegExp(
210+
$this->assertMatchesRegularExpression(
211211
'{Class "?Symfony\\\\Component\\\\DependencyInjection\\\\Tests\\\\Fixtures\\\\Prototype\\\\BadClasses\\\\MissingClass"? not found}',
212212
$container->getDefinition(MissingParent::class)->getErrors()[0]
213213
);

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testParseFile()
7777
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
7878
} catch (\Exception $e) {
7979
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
80-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
80+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
8181

8282
$e = $e->getPrevious();
8383
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
@@ -91,7 +91,7 @@ public function testParseFile()
9191
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
9292
} catch (\Exception $e) {
9393
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
94-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
94+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
9595

9696
$e = $e->getPrevious();
9797
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
@@ -104,13 +104,17 @@ public function testParseFile()
104104

105105
public function testLoadWithExternalEntitiesDisabled()
106106
{
107-
$disableEntities = libxml_disable_entity_loader(true);
107+
if (LIBXML_VERSION < 20900) {
108+
$disableEntities = libxml_disable_entity_loader(true);
109+
}
108110

109111
$containerBuilder = new ContainerBuilder();
110112
$loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath.'/xml'));
111113
$loader->load('services2.xml');
112114

113-
libxml_disable_entity_loader($disableEntities);
115+
if (LIBXML_VERSION < 20900) {
116+
libxml_disable_entity_loader($disableEntities);
117+
}
114118

115119
$this->assertGreaterThan(0, $containerBuilder->getParameterBag()->all(), 'Parameters can be read from the config file.');
116120
}
@@ -532,7 +536,7 @@ public function testExtensions()
532536
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
533537
} catch (\Exception $e) {
534538
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
535-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
539+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
536540

537541
$e = $e->getPrevious();
538542
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -569,7 +573,7 @@ public function testExtensionInPhar()
569573
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
570574
} catch (\Exception $e) {
571575
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
572-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
576+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
573577

574578
$e = $e->getPrevious();
575579
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -620,7 +624,7 @@ public function testDocTypeIsNotAllowed()
620624
$this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type');
621625
} catch (\Exception $e) {
622626
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
623-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
627+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
624628

625629
$e = $e->getPrevious();
626630
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ public function testAnonymousServices()
654654
$this->assertCount(1, $args);
655655
$this->assertInstanceOf(Reference::class, $args[0]);
656656
$this->assertTrue($container->has((string) $args[0]));
657-
$this->assertRegExp('/^\.\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
657+
$this->assertMatchesRegularExpression('/^\.\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
658658

659659
$anonymous = $container->getDefinition((string) $args[0]);
660660
$this->assertEquals('Bar', $anonymous->getClass());
@@ -666,7 +666,7 @@ public function testAnonymousServices()
666666
$this->assertIsArray($factory);
667667
$this->assertInstanceOf(Reference::class, $factory[0]);
668668
$this->assertTrue($container->has((string) $factory[0]));
669-
$this->assertRegExp('/^\.\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
669+
$this->assertMatchesRegularExpression('/^\.\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
670670
$this->assertEquals('constructFoo', $factory[1]);
671671

672672
$anonymous = $container->getDefinition((string) $factory[0]);

0 commit comments

Comments
 (0)