Skip to content

Commit 55da229

Browse files
Merge branch '2.7' into 2.8
* 2.7: [Validator] phpize default option values test for the Validator component to be present [DependencyInjection] Fix on-invalid attribute type in xsd [FrameworkBundle] Fix PHP form templates on translatable attributes [VarDumper] Fix dumping by-ref variadics
2 parents 1d6d5fe + 0a4a92b commit 55da229

File tree

8 files changed

+19
-8
lines changed

8 files changed

+19
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,10 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
764764
return;
765765
}
766766

767+
if (!class_exists('Symfony\Component\Validator\Validation')) {
768+
throw new LogicException('Validation support cannot be enabled as the Validator component is not installed.');
769+
}
770+
767771
$loader->load('validator.xml');
768772

769773
$validatorBuilder = $container->getDefinition('validator.builder');

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_attributes.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($disabled): ?>disabled="disabled" <?php endif ?>
22
<?php foreach ($attr as $k => $v): ?>
3-
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
3+
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
44
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
55
<?php elseif ($v === true): ?>
66
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_container_attributes.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>" <?php endif ?>
22
<?php foreach ($attr as $k => $v): ?>
3-
<?php if (in_array($v, array('placeholder', 'title'), true)): ?>
3+
<?php if (in_array($k, array('placeholder', 'title'), true)): ?>
44
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?>
55
<?php elseif ($v === true): ?>
66
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>

src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<xsd:attribute name="id" type="xsd:string" />
154154
<xsd:attribute name="key" type="xsd:string" />
155155
<xsd:attribute name="name" type="xsd:string" />
156-
<xsd:attribute name="on-invalid" type="xsd:string" />
156+
<xsd:attribute name="on-invalid" type="invalid_sequence" />
157157
<xsd:attribute name="strict" type="boolean" />
158158
</xsd:complexType>
159159

@@ -166,7 +166,7 @@
166166
<xsd:attribute name="id" type="xsd:string" />
167167
<xsd:attribute name="key" type="xsd:string" />
168168
<xsd:attribute name="index" type="xsd:integer" />
169-
<xsd:attribute name="on-invalid" type="xsd:string" />
169+
<xsd:attribute name="on-invalid" type="invalid_sequence" />
170170
<xsd:attribute name="strict" type="boolean" />
171171
</xsd:complexType>
172172

src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function parseConstraints(\SimpleXMLElement $nodes)
8484
$options = array();
8585
}
8686
} elseif (strlen((string) $node) > 0) {
87-
$options = trim($node);
87+
$options = XmlUtils::phpize(trim($node));
8888
} else {
8989
$options = null;
9090
}

src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Validator\Constraints\Range;
2020
use Symfony\Component\Validator\Constraints\Regex;
2121
use Symfony\Component\Validator\Constraints\IsTrue;
22+
use Symfony\Component\Validator\Constraints\Traverse;
2223
use Symfony\Component\Validator\Exception\MappingException;
2324
use Symfony\Component\Validator\Mapping\ClassMetadata;
2425
use Symfony\Component\Validator\Mapping\Loader\XmlFileLoader;
@@ -57,6 +58,7 @@ public function testLoadClassMetadata()
5758
$expected->addConstraint(new Callback('validateMe'));
5859
$expected->addConstraint(new Callback('validateMeStatic'));
5960
$expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback')));
61+
$expected->addConstraint(new Traverse(false));
6062
$expected->addPropertyConstraint('firstName', new NotNull());
6163
$expected->addPropertyConstraint('firstName', new Range(array('min' => 3)));
6264
$expected->addPropertyConstraint('firstName', new Choice(array('A', 'B')));

src/Symfony/Component/Validator/Tests/Mapping/Loader/constraint-mapping.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<value>callback</value>
3232
</constraint>
3333

34+
<!-- Traverse with boolean default option -->
35+
<constraint name="Traverse">
36+
false
37+
</constraint>
38+
3439
<!-- PROPERTY CONSTRAINTS -->
3540

3641
<property name="firstName">

src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,12 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra
178178

179179
foreach ($c->getParameters() as $v) {
180180
$k = '$'.$v->name;
181-
if ($v->isPassedByReference()) {
182-
$k = '&'.$k;
183-
}
184181
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
185182
$k = '...'.$k;
186183
}
184+
if ($v->isPassedByReference()) {
185+
$k = '&'.$k;
186+
}
187187
$a[$prefix.'parameters'][$k] = $v;
188188
}
189189
if (isset($a[$prefix.'parameters'])) {

0 commit comments

Comments
 (0)