Skip to content

Commit 1af8b2c

Browse files
Merge branch '3.3' into 3.4
* 3.3: [DI] Handle root namespace in service definitions Use rawurlencode() to transform the Cookie into a string [Process] Fix parsing args on Windows [HttpKernel][VarDumper] Truncate profiler data & optim perf [Security] Fix authentication.failure event not dispatched on AccountStatusException
2 parents 21d72b0 + bf547e4 commit 1af8b2c

File tree

2 files changed

+28
-65
lines changed

2 files changed

+28
-65
lines changed

Extension/DataCollector/FormDataCollector.php

Lines changed: 25 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@
2020
use Symfony\Component\Validator\ConstraintViolationInterface;
2121
use Symfony\Component\VarDumper\Caster\Caster;
2222
use Symfony\Component\VarDumper\Caster\ClassStub;
23-
use Symfony\Component\VarDumper\Caster\CutStub;
24-
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
25-
use Symfony\Component\VarDumper\Cloner\Data;
2623
use Symfony\Component\VarDumper\Cloner\Stub;
27-
use Symfony\Component\VarDumper\Cloner\VarCloner;
2824

2925
/**
3026
* Data collector for {@link FormInterface} instances.
@@ -77,11 +73,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
7773
*/
7874
private $valueExporter;
7975

80-
/**
81-
* @var ClonerInterface
82-
*/
83-
private $cloner;
84-
8576
private $hasVarDumper;
8677

8778
public function __construct(FormDataExtractorInterface $dataExtractor)
@@ -255,61 +246,33 @@ public function serialize()
255246
/**
256247
* {@inheritdoc}
257248
*/
258-
protected function cloneVar($var, $isClass = false)
249+
protected function getCasters()
259250
{
260-
if ($var instanceof Data) {
261-
return $var;
262-
}
263-
if (null === $this->cloner) {
264-
if ($this->hasVarDumper) {
265-
$this->cloner = new VarCloner();
266-
$this->cloner->setMaxItems(-1);
267-
$this->cloner->addCasters(array(
268-
'*' => function ($v, array $a, Stub $s, $isNested) {
269-
foreach ($a as &$v) {
270-
if (is_object($v) && !$v instanceof \DateTimeInterface) {
271-
$v = new CutStub($v);
272-
}
273-
}
274-
275-
return $a;
276-
},
277-
\Exception::class => function (\Exception $e, array $a, Stub $s) {
278-
if (isset($a[$k = "\0Exception\0previous"])) {
279-
unset($a[$k]);
280-
++$s->cut;
281-
}
282-
283-
return $a;
284-
},
285-
FormInterface::class => function (FormInterface $f, array $a) {
286-
return array(
287-
Caster::PREFIX_VIRTUAL.'name' => $f->getName(),
288-
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
289-
);
290-
},
291-
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
292-
return array(
293-
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
294-
Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(),
295-
Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(),
296-
);
297-
},
298-
));
299-
} else {
300-
@trigger_error(sprintf('Using the %s() method without the VarDumper component is deprecated since version 3.2 and won\'t be supported in 4.0. Install symfony/var-dumper version 3.2 or above.', __METHOD__), E_USER_DEPRECATED);
301-
$this->cloner = false;
302-
}
303-
}
304-
if (false !== $this->cloner) {
305-
return $this->cloner->cloneVar($var, Caster::EXCLUDE_VERBOSE);
306-
}
307-
308-
if (null === $this->valueExporter) {
309-
$this->valueExporter = new ValueExporter();
310-
}
251+
return parent::getCasters() + array(
252+
\Exception::class => function (\Exception $e, array $a, Stub $s) {
253+
foreach (array("\0Exception\0previous", "\0Exception\0trace") as $k) {
254+
if (isset($a[$k])) {
255+
unset($a[$k]);
256+
++$s->cut;
257+
}
258+
}
311259

312-
return $this->valueExporter->exportValue($var);
260+
return $a;
261+
},
262+
FormInterface::class => function (FormInterface $f, array $a) {
263+
return array(
264+
Caster::PREFIX_VIRTUAL.'name' => $f->getName(),
265+
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
266+
);
267+
},
268+
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
269+
return array(
270+
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
271+
Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(),
272+
Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(),
273+
);
274+
},
275+
);
313276
}
314277

315278
private function &recursiveBuildPreliminaryFormTree(FormInterface $form, array &$outputByHash)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/dependency-injection": "~3.3|~4.0",
3030
"symfony/config": "~2.7|~3.0|~4.0",
3131
"symfony/http-foundation": "~2.8|~3.0|~4.0",
32-
"symfony/http-kernel": "~2.8|~3.0|~4.0",
32+
"symfony/http-kernel": "^3.3.5|~4.0",
3333
"symfony/security-csrf": "~2.8|~3.0|~4.0",
3434
"symfony/translation": "~2.8|~3.0|~4.0",
3535
"symfony/var-dumper": "~3.3|~4.0"
@@ -39,8 +39,8 @@
3939
"symfony/dependency-injection": "<3.3",
4040
"symfony/doctrine-bridge": "<2.7",
4141
"symfony/framework-bundle": "<2.7",
42-
"symfony/twig-bridge": "<2.7",
43-
"symfony/var-dumper": "<3.3"
42+
"symfony/http-kernel": "<3.3.5",
43+
"symfony/twig-bridge": "<2.7"
4444
},
4545
"suggest": {
4646
"symfony/validator": "For form validation.",

0 commit comments

Comments
 (0)