8000 bug #34636 [VarDumper] notice on potential undefined index (sylvainme… · symfony/symfony@3f13e8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f13e8e

Browse files
bug #34636 [VarDumper] notice on potential undefined index (sylvainmetayer)
This PR was squashed before being merged into the 4.3 branch. Discussion ---------- [VarDumper] notice on potential undefined index Fix the following issue that can happen (Drupal 8 project for context, with the [Twig vardumper](https://www.drupal.org/project/twig_vardumper) module) : ``` Notice: Undefined index: file in Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider->getContext() (line 55 of /var/www/app/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php). ``` | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | None | License | MIT | Doc PR | N/A Commits ------- d4c34e0 [VarDumper] notice on potential undefined index
2 parents 74cfa36 + d4c34e0 commit 3f13e8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/VarDumper/Dumper/ContextProvider/SourceContextProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function getContext(): ?array
5252
&& 'dump' === $trace[$i]['function']
5353
&& VarDumper::class === $trace[$i]['class']
5454
) {
55-
$file = $trace[$i]['file'];
56-
$line = $trace[$i]['line'];
55+
$file = $trace[$i]['file'] ?? $file;
56+
$line = $trace[$i]['line'] ?? $line;
5757

5858
while (++$i < $this->limit) {
5959
if (isset($trace[$i]['function'], $trace[$i]['file']) && empty($trace[$i]['class']) && 0 !== strpos($trace[$i]['function'], 'call_user_func')) {

0 commit comments

Comments
 (0)
0