Skip to content

Commit 502a03b

Browse files
Enhance GAE compat by removing some realpath()
1 parent a48e6f8 commit 502a03b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FrameworkExtension extends Extension
5252
*/
5353
public function load(array $configs, ContainerBuilder $container)
5454
{
55-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
55+
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config'));
5656

5757
$loader->load('web.xml');
5858
$loader->load('services.xml');
@@ -689,7 +689,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
689689
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
690690
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
691691

692-
$dirs[] = dirname($r->getFileName()).'/../Resources/translations';
692+
$dirs[] = dirname(dirname($r->getFileName())).'/Resources/translations';
693693
}
694694
$rootDir = $container->getParameter('kernel.root_dir');
695695
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
@@ -811,21 +811,21 @@ private function getValidatorMappingFiles(ContainerBuilder $container)
811811
$dirname = dirname($reflection->getFileName());
812812

813813
if (is_file($file = $dirname.'/Resources/config/validation.xml')) {
814-
$files[0][] = realpath($file);
814+
$files[0][] = $file;
815815
$container->addResource(new FileResource($file));
816816
}
817817

818818
if (is_file($file = $dirname.'/Resources/config/validation.yml')) {
819-
$files[1][] = realpath($file);
819+
$files[1][] = $file;
820820
$container->addResource(new FileResource($file));
821821
}
822822

823823
if (is_dir($dir = $dirname.'/Resources/config/validation')) {
824824
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
825-
$files[0][] = $file->getRealPath();
825+
$files[0][] = $file->getPathname();
826826
}
827827
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
828-
$files[1][] = $file->getRealPath();
828+
$files[1][] = $file->getPathname();
829829
}
830830

831831
$container->addResource(new DirectoryResource($dir));
@@ -926,15 +926,15 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
926926
$dirname = dirname($reflection->getFileName());
927927

928928
if (is_file($file = $dirname.'/Resources/config/serialization.xml')) {
929-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array(realpath($file)));
929+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file));
930930
$definition->setPublic(false);
931931

932932
$serializerLoaders[] = $definition;
933933
$container->addResource(new FileResource($file));
934934
}
935935

936936
if (is_file($file = $dirname.'/Resources/config/serialization.yml')) {
937-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array(realpath($file)));
937+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file));
938938
$definition->setPublic(false);
939939

940940
$serializerLoaders[] = $definition;
@@ -943,13 +943,13 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
943943

944944
if (is_dir($dir = $dirname.'/Resources/config/serialization')) {
945945
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
946-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealPath()));
946+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getPathname()));
947947
$definition->setPublic(false);
948948

949949
$serializerLoaders[] = $definition;
950950
}
951951
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
952-
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealPath()));
952+
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getPathname()));
953953
$definition->setPublic(false);
954954

955955
$serializerLoaders[] = $definition;
@@ -996,7 +996,7 @@ private function getKernelRootHash(ContainerBuilder $container)
996996
*/
997997
public function getXsdValidationBasePath()
998998
{
999-
return __DIR__.'/../Resources/config/schema';
999+
return dirname(__DIR__).'/Resources/config/schema';
10001000
}
10011001

10021002
public function getNamespace()

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ public function testValidationPaths()
363363
// Testing symfony/framework-bundle with deps=high
364364
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
365365
}
366-
$this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.xml', $xmlMappings[1]);
366+
$this->assertStringEndsWith('TestBundle/Resources/config/validation.xml', $xmlMappings[1]);
367367

368368
$yamlMappings = $calls[4][1][0];
369369
$this->assertCount(1, $yamlMappings);
370-
$this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.yml', $yamlMappings[0]);
370+
$this->assertStringEndsWith('TestBundle/Resources/config/validation.yml', $yamlMappings[0]);
371371
}
372372

373373
public function testValidationNoStaticMethod()

0 commit comments

Comments
 (0)