Enhance GAE compat by removing some realpath()
This commit is contained in:
parent
ed11f22360
commit
f2f232d599
@ -134,10 +134,7 @@ abstract class AbstractDoctrineExtension extends Extension
|
|||||||
throw new \InvalidArgumentException(sprintf('Invalid Doctrine mapping path given. Cannot load Doctrine mapping/bundle named "%s".', $mappingName));
|
throw new \InvalidArgumentException(sprintf('Invalid Doctrine mapping path given. Cannot load Doctrine mapping/bundle named "%s".', $mappingName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($mappingDirectory, 0, 7) !== 'phar://') {
|
$this->drivers[$mappingConfig['type']][$mappingConfig['prefix']] = realpath($mappingDirectory) ?: $mappingDirectory;
|
||||||
$mappingDirectory = realpath($mappingDirectory);
|
|
||||||
}
|
|
||||||
$this->drivers[$mappingConfig['type']][$mappingConfig['prefix']] = $mappingDirectory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ class DoctrineValidationPass implements CompilerPassInterface
|
|||||||
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
||||||
$reflection = new \ReflectionClass($bundle);
|
$reflection = new \ReflectionClass($bundle);
|
||||||
if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
|
if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
|
||||||
$files[] = realpath($file);
|
$files[] = $file;
|
||||||
$container->addResource(new FileResource($file));
|
$container->addResource(new FileResource($file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface
|
|||||||
if ($file instanceof SplFileInfo) {
|
if ($file instanceof SplFileInfo) {
|
||||||
$e->setTemplateName($file->getRelativePathname());
|
$e->setTemplateName($file->getRelativePathname());
|
||||||
} elseif ($file instanceof \SplFileInfo) {
|
} elseif ($file instanceof \SplFileInfo) {
|
||||||
$e->setTemplateName($file->getRealPath());
|
$e->setTemplateName($file->getRealPath() ?: $file->getPathname());
|
||||||
}
|
}
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -52,7 +52,7 @@ class FrameworkExtension extends Extension
|
|||||||
*/
|
*/
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config'));
|
||||||
|
|
||||||
$loader->load('web.xml');
|
$loader->load('web.xml');
|
||||||
$loader->load('services.xml');
|
$loader->load('services.xml');
|
||||||
@ -689,7 +689,7 @@ class FrameworkExtension extends Extension
|
|||||||
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFileName()).'/../Resources/translations';
|
$dirs[] = dirname(dirname($r->getFileName())).'/Resources/translations';
|
||||||
}
|
}
|
||||||
$rootDir = $container->getParameter('kernel.root_dir');
|
$rootDir = $container->getParameter('kernel.root_dir');
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||||
@ -811,21 +811,21 @@ class FrameworkExtension extends Extension
|
|||||||
$dirname = dirname($reflection->getFileName());
|
$dirname = dirname($reflection->getFileName());
|
||||||
|
|
||||||
if (is_file($file = $dirname.'/Resources/config/validation.xml')) {
|
if (is_file($file = $dirname.'/Resources/config/validation.xml')) {
|
||||||
$files[0][] = realpath($file);
|
$files[0][] = $file;
|
||||||
$container->addResource(new FileResource($file));
|
$container->addResource(new FileResource($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_file($file = $dirname.'/Resources/config/validation.yml')) {
|
if (is_file($file = $dirname.'/Resources/config/validation.yml')) {
|
||||||
$files[1][] = realpath($file);
|
$files[1][] = $file;
|
||||||
$container->addResource(new FileResource($file));
|
$container->addResource(new FileResource($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($dir = $dirname.'/Resources/config/validation')) {
|
if (is_dir($dir = $dirname.'/Resources/config/validation')) {
|
||||||
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
|
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
|
||||||
$files[0][] = $file->getRealPath();
|
$files[0][] = $file->getPathname();
|
||||||
}
|
}
|
||||||
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
|
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
|
||||||
$files[1][] = $file->getRealPath();
|
$files[1][] = $file->getPathname();
|
||||||
}
|
}
|
||||||
|
|
||||||
$container->addResource(new DirectoryResource($dir));
|
$container->addResource(new DirectoryResource($dir));
|
||||||
@ -926,7 +926,7 @@ class FrameworkExtension extends Extension
|
|||||||
$dirname = dirname($reflection->getFileName());
|
$dirname = dirname($reflection->getFileName());
|
||||||
|
|
||||||
if (is_file($file = $dirname.'/Resources/config/serialization.xml')) {
|
if (is_file($file = $dirname.'/Resources/config/serialization.xml')) {
|
||||||
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array(realpath($file)));
|
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file));
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
|
|
||||||
$serializerLoaders[] = $definition;
|
$serializerLoaders[] = $definition;
|
||||||
@ -934,7 +934,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_file($file = $dirname.'/Resources/config/serialization.yml')) {
|
if (is_file($file = $dirname.'/Resources/config/serialization.yml')) {
|
||||||
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array(realpath($file)));
|
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file));
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
|
|
||||||
$serializerLoaders[] = $definition;
|
$serializerLoaders[] = $definition;
|
||||||
@ -943,13 +943,13 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if (is_dir($dir = $dirname.'/Resources/config/serialization')) {
|
if (is_dir($dir = $dirname.'/Resources/config/serialization')) {
|
||||||
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
|
foreach (Finder::create()->files()->in($dir)->name('*.xml') as $file) {
|
||||||
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getRealPath()));
|
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array($file->getPathname()));
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
|
|
||||||
$serializerLoaders[] = $definition;
|
$serializerLoaders[] = $definition;
|
||||||
}
|
}
|
||||||
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
|
foreach (Finder::create()->files()->in($dir)->name('*.yml') as $file) {
|
||||||
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getRealPath()));
|
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader', array($file->getPathname()));
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
|
|
||||||
$serializerLoaders[] = $definition;
|
$serializerLoaders[] = $definition;
|
||||||
@ -996,7 +996,7 @@ class FrameworkExtension extends Extension
|
|||||||
*/
|
*/
|
||||||
public function getXsdValidationBasePath()
|
public function getXsdValidationBasePath()
|
||||||
{
|
{
|
||||||
return __DIR__.'/../Resources/config/schema';
|
return dirname(__DIR__).'/Resources/config/schema';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNamespace()
|
public function getNamespace()
|
||||||
|
@ -363,11 +363,11 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
// Testing symfony/framework-bundle with deps=high
|
// Testing symfony/framework-bundle with deps=high
|
||||||
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||||
}
|
}
|
||||||
$this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.xml', $xmlMappings[1]);
|
$this->assertStringEndsWith('TestBundle/Resources/config/validation.xml', $xmlMappings[1]);
|
||||||
|
|
||||||
$yamlMappings = $calls[4][1][0];
|
$yamlMappings = $calls[4][1][0];
|
||||||
$this->assertCount(1, $yamlMappings);
|
$this->assertCount(1, $yamlMappings);
|
||||||
$this->assertStringEndsWith('TestBundle'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'validation.yml', $yamlMappings[0]);
|
$this->assertStringEndsWith('TestBundle/Resources/config/validation.yml', $yamlMappings[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testValidationNoStaticMethod()
|
public function testValidationNoStaticMethod()
|
||||||
|
@ -62,7 +62,7 @@ class ClassCollectionLoader
|
|||||||
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
|
if (!is_dir($cacheDir) && !@mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
|
||||||
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
|
throw new \RuntimeException(sprintf('Class Collection Loader was not able to create directory "%s"', $cacheDir));
|
||||||
}
|
}
|
||||||
$cacheDir = rtrim(realpath($cacheDir), '/'.DIRECTORY_SEPARATOR);
|
$cacheDir = rtrim(realpath($cacheDir) ?: $cacheDir, '/'.DIRECTORY_SEPARATOR);
|
||||||
$cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension;
|
$cache = $cacheDir.DIRECTORY_SEPARATOR.$name.$extension;
|
||||||
|
|
||||||
// auto-reload
|
// auto-reload
|
||||||
|
@ -64,7 +64,7 @@ class ClassMapGenerator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $file->getRealPath();
|
$path = $file->getRealPath() ?: $file->getPathname();
|
||||||
|
|
||||||
if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
|
if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -32,7 +32,7 @@ class FileResource implements ResourceInterface, \Serializable
|
|||||||
*/
|
*/
|
||||||
public function __construct($resource)
|
public function __construct($resource)
|
||||||
{
|
{
|
||||||
$this->resource = realpath($resource);
|
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ class DateRangeFilterIterator extends FilterIterator
|
|||||||
{
|
{
|
||||||
$fileinfo = $this->current();
|
$fileinfo = $this->current();
|
||||||
|
|
||||||
if (!file_exists($fileinfo->getRealPath())) {
|
if (!file_exists($fileinfo->getPathname())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class SortableIterator implements \IteratorAggregate
|
|||||||
|
|
||||||
if (self::SORT_BY_NAME === $sort) {
|
if (self::SORT_BY_NAME === $sort) {
|
||||||
$this->sort = function ($a, $b) {
|
$this->sort = function ($a, $b) {
|
||||||
return strcmp($a->getRealpath(), $b->getRealpath());
|
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||||
};
|
};
|
||||||
} elseif (self::SORT_BY_TYPE === $sort) {
|
} elseif (self::SORT_BY_TYPE === $sort) {
|
||||||
$this->sort = function ($a, $b) {
|
$this->sort = function ($a, $b) {
|
||||||
@ -51,7 +51,7 @@ class SortableIterator implements \IteratorAggregate
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcmp($a->getRealpath(), $b->getRealpath());
|
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||||
};
|
};
|
||||||
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
|
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
|
||||||
$this->sort = function ($a, $b) {
|
$this->sort = function ($a, $b) {
|
||||||
|
@ -244,7 +244,7 @@ final class Intl
|
|||||||
*/
|
*/
|
||||||
public static function getDataDirectory()
|
public static function getDataDirectory()
|
||||||
{
|
{
|
||||||
return realpath(__DIR__.'/Resources/data');
|
return __DIR__.'/Resources/data';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user