Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 56bfbd8

Browse filesBrowse files
bug #34902 [PropertyAccess] forward caught exception (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [PropertyAccess] forward caught exception | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #34899 | License | MIT | Doc PR | Commits ------- 98e18d3 forward caught exception
2 parents bf877b8 + 98e18d3 commit 56bfbd8
Copy full SHA for 56bfbd8

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/PropertyAccessor.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
229229
$value = $zval[self::VALUE];
230230
}
231231
} catch (\TypeError $e) {
232-
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0);
232+
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $e);
233233

234234
// It wasn't thrown in this class so rethrow it
235235
throw $e;
@@ -253,7 +253,7 @@ public static function handleError($type, $message, $file, $line, $context = [])
253253
return null !== self::$previousErrorHandler && false !== \call_user_func(self::$previousErrorHandler, $type, $message, $file, $line, $context);
254254
}
255255

256-
private static function throwInvalidArgumentException($message, $trace, $i)
256+
private static function throwInvalidArgumentException($message, $trace, $i, $previous = null)
257257
{
258258
// the type mismatch is not caused by invalid arguments (but e.g. by an incompatible return type hint of the writer method)
259259
if (0 !== strpos($message, 'Argument ')) {
@@ -267,7 +267,7 @@ private static function throwInvalidArgumentException($message, $trace, $i)
267267
$type = substr($message, 2 + $j, strpos($message, ' given', $j) - $j - 2);
268268
$message = substr($message, $pos, $j - $pos);
269269

270-
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given', $message, 'NULL' === $type ? 'null' : $type));
270+
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given', $message, 'NULL' === $type ? 'null' : $type), 0, $previous);
271271
}
272272
}
273273

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.