Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b56c2b4

Browse files
committed
bug #12291 [Form] Fixed usage of "name" variable in form_start block (webmozart)
This PR was merged into the 2.5 branch. Discussion ---------- [Form] Fixed usage of "name" variable in form_start block | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10192 | License | MIT | Doc PR | - Commits ------- 5839832 [Form] Fixed usage of "name" variable in form_start block
2 parents b5b12a5 + 5839832 commit b56c2b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
{%- else -%}
255255
{% set form_method = "POST" %}
256256
{%- endif -%}
257-
<form name="{{ form.vars.name }}" method="{{ form_method|lower }}" action="{{ action }}"{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %}>
257+
<form name="{{ name }}" method="{{ form_method|lower }}" action="{{ action }}"{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %}>
258258
{%- if form_method != method -%}
259259
<input type="hidden" name="_method" value="{{ method }}" />
260260
{%- endif -%}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php $method = strtoupper($method) ?>
22
<?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?>
3-
<form name="<?php echo $form->vars['name'] ?>" method="<?php echo strtolower($form_method) ?>" action="<?php echo $action ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
3+
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>" action="<?php echo $action ?>"<?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
44
<?php if ($form_method !== $method): ?>
55
<input type="hidden" name="_method" value="<?php echo $method ?>" />
66
<?php endif ?>

0 commit comments

Comments
 (0)