Merge branch '3.4'

* 3.4:
  [TwigBridge] Bootstrap 4 form theme fixes
  [VarDumper] HtmlDumper: fix collapsing nodes with depth <= maxDepth
  Fixing a bug where non-existent classes would cause issues
  Do not activate the cache if Doctrine's cache is not present
  [SecurityBundle] hotfix: update phpdocs on logout url
  [FrameworkBundle] Do not load property_access.xml if the component isn't installed
  [HttpFoundation] Mark new methods on Response as final
  Fixed a few spelling mistakes in Luxembourgish translation
  [TwigBridge] Fix template paths in profiler
This commit is contained in:
Fabien Potencier 2017-10-29 14:09:05 -07:00
commit d8ee14f9a0
9 changed files with 56 additions and 21 deletions

View File

@ -63,9 +63,18 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
$this->data['template_paths'] = array();
$templateFinder = function (Profile $profile) use (&$templateFinder) {
if ($profile->isTemplate() && $template = $this->twig->load($profile->getName())->getSourceContext()->getPath()) {
$this->data['template_paths'][$profile->getName()] = $template;
if ($profile->isTemplate()) {
try {
$template = $this->twig->load($name = $profile->getName());
} catch (\Twig_Error_Loader $e) {
$template = null;
}
if (null !== $template && '' !== $path = $template->getSourceContext()->getPath()) {
$this->data['template_paths'][$name] = $path;
}
}
foreach ($profile as $p) {
$templateFinder($p);
}

View File

@ -70,11 +70,12 @@
{# Labels #}
{% block form_label -%}
{%- if expanded is defined and expanded -%}
{%- if compound is defined and compound -%}
{%- set element = 'legend' -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' col-form-legend')|trim}) -%}
{%- else -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%}
{%- endif -%}
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-control-label')|trim}) -%}
{{- parent() -}}
{%- endblock form_label %}
@ -107,7 +108,7 @@
{# Rows #}
{% block form_row -%}
{%- if expanded is defined and expanded -%}
{%- if compound is defined and compound -%}
{%- set element = 'fieldset' -%}
{%- endif -%}
<{{ element|default('div') }} class="form-group">

View File

@ -242,7 +242,18 @@ EOF
return false;
}
// see if the class exists (only need to trigger autoload once)
return class_exists($serviceId) || interface_exists($serviceId, false);
// if the id has a \, assume it is a class
if (false !== strpos($serviceId, '\\')) {
return true;
}
try {
$r = new \ReflectionClass($serviceId);
return true;
} catch (\ReflectionException $e) {
// the service id is not a valid class/interface
return false;
}
}
}

View File

@ -12,6 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Cache\Cache;
use Symfony\Bundle\FullStack;
use Symfony\Component\Asset\Package;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
@ -676,7 +677,7 @@ class Configuration implements ConfigurationInterface
->info('annotation configuration')
->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
->children()
->scalarNode('cache')->defaultValue('php_array')->end()
->scalarNode('cache')->defaultValue(interface_exists(Cache::class) ? 'php_array' : 'none')->end()
->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()
->booleanNode('debug')->defaultValue($this->debug)->end()
->end()

View File

@ -127,9 +127,6 @@ class FrameworkExtension extends Extension
}
}
// Property access is used by both the Form and the Validator component
$loader->load('property_access.xml');
// Load Cache configuration first as it is used by other components
$loader->load('cache.xml');
@ -237,7 +234,7 @@ class FrameworkExtension extends Extension
$this->registerDebugConfiguration($config['php_errors'], $container, $loader);
$this->registerRouterConfiguration($config['router'], $container, $loader);
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
$this->registerPropertyAccessConfiguration($config['property_access'], $container);
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
if ($this->isConfigEnabled($container, $config['serializer'])) {
$this->registerSerializerConfiguration($config['serializer'], $container, $loader);
@ -1096,8 +1093,14 @@ class FrameworkExtension extends Extension
}
}
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container)
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
return;
}
$loader->load('property_access.xml');
$container
->getDefinition('property_accessor')
->replaceArgument(0, $config['magic_call'])
@ -1133,6 +1136,11 @@ class FrameworkExtension extends Extension
$chainLoader = $container->getDefinition('serializer.mapping.chain_loader');
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccessor')) {
$container->removeAlias('serializer.property_accessor');
$container->removeDefinition('serializer.normalizer.object');
}
$serializerLoaders = array();
if (isset($config['enable_annotations']) && $config['enable_annotations']) {
if (!$this->annotationsConfigEnabled) {

View File

@ -296,9 +296,9 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
}
/**
* Get the provider key (i.e. the name of the active firewall).
* Get the logout URL.
*
* @return string The provider key
* @return string The logout URL
*/
public function getLogoutUrl()
{

View File

@ -612,6 +612,8 @@ class Response
* @param bool $immutable enables or disables the immutable directive
*
* @return $this
*
* @final
*/
public function setImmutable($immutable = true)
{
@ -628,6 +630,8 @@ class Response
* Returns true if the response is marked as "immutable".
*
* @return bool returns true if the response is marked as "immutable"; otherwise false
*
* @final
*/
public function isImmutable()
{

View File

@ -140,7 +140,7 @@
</trans-unit>
<trans-unit id="38">
<source>This value is not a valid language.</source>
<target>Dëse Wäert aentsprécht kenger gëlteger Sprooch.</target>
<target>Dëse Wäert entsprécht kenger gëlteger Sprooch.</target>
</trans-unit>
<trans-unit id="39">
<source>This value is not a valid locale.</source>
@ -180,7 +180,7 @@
</trans-unit>
<trans-unit id="48">
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
<target>Dëse Wäert sollt exactly {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn.</target>
<target>Dëse Wäert sollt exakt {{ limit }} Buschtaf hunn.|Dëse Wäert sollt exakt {{ limit }} Buschtawen hunn.</target>
</trans-unit>
<trans-unit id="49">
<source>The file was only partially uploaded.</source>
@ -192,7 +192,7 @@
</trans-unit>
<trans-unit id="51">
<source>No temporary folder was configured in php.ini.</source>
<target>Et gouf keen temporären Dossier an der php.ini konfiguréiert.</target>
<target>Et gouf keen temporären Dossier an der php.ini konfiguréiert oder den temporären Dossier existéiert net.</target>
</trans-unit>
<trans-unit id="52">
<source>Cannot write temporary file to disk.</source>
@ -304,7 +304,7 @@
</trans-unit>
<trans-unit id="79">
<source>The host could not be resolved.</source>
<target>Den Domain-Numm konnt net opgeléist ginn.</target>
<target>Den Host-Numm konnt net opgeléist ginn.</target>
</trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>

View File

@ -383,8 +383,9 @@ return function (root, x) {
x += elt.parentNode.getAttribute('data-depth')/1;
}
elt.setAttribute('data-depth', x);
if (elt.className ? 'sf-dump-expanded' !== elt.className : (x > options.maxDepth)) {
elt.className = 'sf-dump-expanded';
var className = elt.className;
elt.className = 'sf-dump-expanded';
if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) {
toggle(a);
}
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {