Merge branch '3.4' into 4.1

* 3.4:
  [Finder] fixed root directory access for ftp/sftp wrapper
  [FWBundle] Throw if PropertyInfo is enabled, but the component isn't installed
This commit is contained in:
Fabien Potencier 2018-10-03 10:47:56 +02:00
commit c48ee0be1e
2 changed files with 16 additions and 3 deletions

View File

@ -69,6 +69,7 @@ use Symfony\Component\Messenger\Transport\TransportInterface;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
@ -263,7 +264,7 @@ class FrameworkExtension extends Extension
}
if ($this->isConfigEnabled($container, $config['property_info'])) {
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader);
$this->registerPropertyInfoConfiguration($container, $loader);
}
if ($this->isConfigEnabled($container, $config['lock'])) {
@ -1352,8 +1353,12 @@ class FrameworkExtension extends Extension
}
}
private function registerPropertyInfoConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
private function registerPropertyInfoConfiguration(ContainerBuilder $container, XmlFileLoader $loader)
{
if (!interface_exists(PropertyInfoExtractorInterface::class)) {
throw new LogicException('PropertyInfo support cannot be enabled as the PropertyInfo component is not installed. Try running "composer require symfony/property-info".');
}
$loader->load('property_info.xml');
if (interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) {

View File

@ -727,12 +727,20 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Normalizes given directory names by removing trailing slashes.
*
* Excluding: (s)ftp:// wrapper
*
* @param string $dir
*
* @return string
*/
private function normalizeDir($dir)
{
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
if (preg_match('#^s?ftp://#', $dir)) {
$dir .= '/';
}
return $dir;
}
}