Merge branch '2.8' into 3.2

* 2.8:
  [VarDumper] ExceptionCaster robustness fix
This commit is contained in:
Nicolas Grekas 2017-03-12 17:07:05 +01:00
commit 567652621a
2 changed files with 2 additions and 5 deletions

View File

@ -1372,7 +1372,6 @@ class ChoiceTypeTest extends BaseTypeTest
$form = $this->factory->create(static::TESTED_TYPE, null, array(
'multiple' => true,
'choices' => array_flip($this->numericChoicesFlipped),
'choices_as_values' => true,
));
$form->submit(array(1, 2));

View File

@ -67,11 +67,9 @@ class ExceptionCaster
$prefix = Caster::PREFIX_PROTECTED;
$xPrefix = "\0Exception\0";
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'])) {
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace']) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
if (isset($a[$prefix.'file'], $a[$prefix.'line'])) {
self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
}
self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
$a[$xPrefix.'trace'] = new TraceStub($b[$xPrefix.'trace'], false, 0, -1 - count($a[$xPrefix.'trace']->value));
}