Skip to content

Commit 4c62edf

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: 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 f33a28e + 7d15cf4 commit 4c62edf

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
@@ -634,9 +634,13 @@ public function validateSchema(\DOMDocument $dom)
634634
EOF
635635
;
636636

637-
$disableEntities = libxml_disable_entity_loader(false);
638-
$valid = @$dom->schemaValidateSource($source);
639-
libxml_disable_entity_loader($disableEntities);
637+
if (LIBXML_VERSION < 20900) {
638+
$disableEntities = libxml_disable_entity_loader(false);
639+
$valid = @$dom->schemaValidateSource($source);
640+
libxml_disable_entity_loader($disableEntities);
641+
} else {
642+
$valid = @$dom->schemaValidateSource($source);
643+
}
640644

641645
foreach ($tmpfiles as $tmpfile) {
642646
@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
@@ -72,7 +72,7 @@ public function testParseFile()
7272
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
7373
} catch (\Exception $e) {
7474
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
75-
$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');
75+
$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');
7676

7777
$e = $e->getPrevious();
7878
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
@@ -86,7 +86,7 @@ public function testParseFile()
8686
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
8787
} catch (\Exception $e) {
8888
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
89-
$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');
89+
$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');
9090

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

100100
public function testLoadWithExternalEntitiesDisabled()
101101
{
102-
$disableEntities = libxml_disable_entity_loader(true);
102+
if (LIBXML_VERSION < 20900) {
103+
$disableEntities = libxml_disable_entity_loader(true);
104+
}
103105

104106
$containerBuilder = new ContainerBuilder();
105107
$loader = new XmlFileLoader($containerBuilder, new FileLocator(self::$fixturesPath.'/xml'));
106108
$loader->load('services2.xml');
107109

108-
libxml_disable_entity_loader($disableEntities);
110+
if (LIBXML_VERSION < 20900) {
111+
libxml_disable_entity_loader($disableEntities);
112+
}
109113

110114
$this->assertGreaterThan(0, $containerBuilder->getParameterBag()->all(), 'Parameters can be read from the config file.');
111115
}
@@ -491,7 +495,7 @@ public function testExtensions()
491495
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
492496
} catch (\Exception $e) {
493497
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
494-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
498+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
495499

496500
$e = $e->getPrevious();
497501
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -528,7 +532,7 @@ public function testExtensionInPhar()
528532
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
529533
} catch (\Exception $e) {
530534
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
531-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
535+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
532536

533537
$e = $e->getPrevious();
534538
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
@@ -579,7 +583,7 @@ public function testDocTypeIsNotAllowed()
579583
$this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type');
580584
} catch (\Exception $e) {
581585
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
582-
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
586+
$this->assertMatchesRegularExpression(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
583587

584588
$e = $e->getPrevious();
585589
$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
@@ -660,7 +660,7 @@ public function testAnonymousServices()
660660
$this->assertCount(1, $args);
661661
$this->assertInstanceOf(Reference::class, $args[0]);
662662
$this->assertTrue($container->has((string) $args[0]));
663-
$this->assertRegExp('/^\.\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
663+
$this->assertMatchesRegularExpression('/^\.\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]);
664664

665665
$anonymous = $container->getDefinition((string) $args[0]);
666666
$this->assertEquals('Bar', $anonymous->getClass());
@@ -672,7 +672,7 @@ public function testAnonymousServices()
672672
$this->assertIsArray($factory);
673673
$this->assertInstanceOf(Reference::class, $factory[0]);
674674
$this->assertTrue($container->has((string) $factory[0]));
675-
$this->assertRegExp('/^\.\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
675+
$this->assertMatchesRegularExpression('/^\.\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]);
676676
$this->assertEquals('constructFoo', $factory[1]);
677677

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

0 commit comments

Comments
 (0)