8000 [TwigBundle] Scope::has returns error: array_key_exists() expects parameter 2 to be array, null given · Issue #7342 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBundle] Scope::has returns error: array_key_exists() expects parameter 2 to be array, null given #7342

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

Closed
stevelacey opened this issue Mar 12, 2013 · 4 comments

Comments

@stevelacey
Copy link

Looks like there's now a problem when testing if a data is visible from current scope?

Twig_Error_Runtime: An exception has been thrown during the compilation of a template ("Warning: array_key_exists() expects parameter 2 to be array, null given in .../vendor/symfony/symfony/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php line 94")

@stevelacey
Copy link
Author

The problem seems to be that $this->data in the Scope class can now be null, when before it was always an array? Now none of my templates work.

@benbender
Copy link

The variable $this->data in src/Symfony/Bridge/Twig/NodeVisitor/Scope.php is not properly initialized as an array. If set()is not called before a call to has() or get(), the variable is null. This leads to the error.

@stof
Copy link
Member
stof commented Mar 12, 2013

Could you send a PR with the fix ?

@benbender
Copy link

Give me a minute. I'll try my first PR :)

fabpot added a commit that referenced this issue Mar 13, 2013
This PR was squashed before being merged into the 2.1 branch (closes #7344).

Commits
-------

c423f16 [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge

Discussion
----------

[2.1][TwigBridge] Fixes Issue #7342 in TwigBridge

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #7342
| License       | MIT
| Doc PR        | --

---------------------------------------------------------------------------

by stof at 2013-03-12T13:28:15Z

Can you add a test to avoid regressions ?

---------------------------------------------------------------------------

by benbender at 2013-03-12T13:54:02Z

Done

---------------------------------------------------------------------------

by stevelacey at 2013-03-12T14:40:59Z

Looks good to me?

---------------------------------------------------------------------------

by pborreli at 2013-03-12T16:04:27Z
7517


:+1:
fabpot added a commit that referenced this issue Mar 15, 2013
* 2.1:
  sub-requests are now created with the same class as their parent
  [FrameworkBundle] removed BC break
  [FrameworkBundle] changed temp kernel name in cache:clear
  [DoctrineBridge] Avoids blob values to be logged by doctrine
  [Security] use current request attributes to generate redirect url?
  [Validator] fix showing wrong max file size for upload errors
  [TwigBridge] removed double var initialization (refs #7344)
  [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge
  [FrameworkBundle] fixed cahe:clear command's warmup
  [TwigBridge] now enter/leave scope on Twig_Node_Module
  [TwigBridge] fixed fixed scope & trans_default_domain node visitor
  [TwigBridge] fixed non probant tests & added new one
  [BrowserKit] added ability to ignored malformed set-cookie header
  [Translation] removed wriong 'use'
  [Translation] added xliff loader/dumper with resname support
  [TwigBridge] fixes

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/HttpKernel.php
	src/Symfony/Component/Security/Http/HttpUtils.php
	src/Symfony/Component/Translation/Loader/XliffFileLoader.php
	src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
@jfsimon jfsimon closed this as completed Apr 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0