Skip to content

[VarDumper] notice on potential undefined index #34636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2019
Merged

[VarDumper] notice on potential undefined index #34636

merged 1 commit into from
Nov 28, 2019

Conversation

sylvainmetayer
Copy link
Contributor

Fix the following issue that can happen (Drupal 8 project for context, with the 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

@sylvainmetayer sylvainmetayer changed the title fix: notice on potential undefined index fix(vardumper): notice on potential undefined index Nov 26, 2019
@stof
Copy link
Member

stof commented Nov 26, 2019

the question is how it is possible to have these non-existent keys in the output of debug_backtrace

@ogizanagi
Copy link
Contributor

Also if it is possible, we should probably not just fallback to null here, it may have other impacts on this code path.

@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Nov 26, 2019
@nicolas-grekas nicolas-grekas changed the title fix(vardumper): notice on potential undefined index [VarDumper] notice on potential undefined index Nov 26, 2019
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Nov 27, 2019

the question is how it is possible to have these non-existent keys in the output of debug_backtrace

it is, PHP inserts virtual frames in a few cases (can't remember exactly which ones)

@sylvainmetayer
Copy link
Contributor Author

I have been trying to reproduce the error today to provide more context but I haven't be able to reproduce it yet.

@nicolas-grekas
Copy link
Member

Thank you @sylvainmetayer.

nicolas-grekas added a commit that referenced this pull request Nov 28, 2019
…tayer)

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
@nicolas-grekas nicolas-grekas merged commit d4c34e0 into symfony:4.3 Nov 28, 2019
This was referenced Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants