Skip to content

[Form] Using form enctype and sandbox together creates a PHP parse error in template compilation. #8660

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
kevintweber opened this issue Aug 3, 2013 · 0 comments
Labels

Comments

@kevintweber
Copy link

I think this is a bug in the Twig Bundle, not Twig itself, but I can't find it, so I may be very wrong.

Steps To Reproduce

  1. Create a twig view with a form containing the following Twig function:
    {{ form_enctype(form) }}
  2. Enable the Twig sandbox.
  3. Clear the cache: php app/console cache:clear

You will receive a PHP parse error:
PHP Parse error: syntax error, unexpected ';' in /home/ ... /app/cache/de_/twig/85/94/1fe242f2c7a336bddc00854ec646.php on line 135

Line 135 is:

echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'enctype');
);

The error is that an extra semi-colon is inserted before the final end-parenthesis.

I realize that form_enctype is deprecated, but several bundles still use it.

I hope this helps.

  • Kevin
fabpot added a commit that referenced this issue Aug 13, 2013
This PR was merged into the 2.3 branch.

Discussion
----------

form_enctype() fix (closes #8660)

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

Commits
-------

572ba68 [TwigBridge] removed superflous ; when rendering form_enctype() (closes #8660)
@fabpot fabpot closed this as completed Aug 13, 2013
fabpot added a commit that referenced this issue Aug 14, 2013
* 2.3:
  [Process] Revert change
  [Process] Fix #8746 : slowness added in unit tests since #8741
  [Process] Fix #8742 : Signal-terminated processes are not successful
  corrected English grammar (s/does not exists/does not exist)
  [Process] Add more precision to Process::stop timeout
  [Process] Avoid zombie process in case of unit tests failure
  [Process] Fix #8739
  [Process] Add failing test for #8739
  [Process] Fix CS
  [TwigBridge] removed superflous ; when rendering form_enctype() (closes #8660)
  Fixed documentation grammar for AuthenticationManagerInterface::authenticate()
  [Validator] fixed the wrong isAbstract() check against the class (fixed #8589)
  [TwigBridge] Prevent code extension to display warning
  Fix internal sub-request creation
  [FrameworkBundle] made code more generic
  [Form] Moved auto_initialize option to the BaseType
  Use strstr instead of strpos
  Make sure ContextErrorException is loaded during compile time errors
  Fix empty process argument escaping on Windows
  Ignore null value in comparison validators

Conflicts:
	src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
	src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php
	src/Symfony/Component/Process/Process.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants