Skip to content

Commit

Permalink
Fix XSS issues in the form theme of the PHP templating engine
Browse files Browse the repository at this point in the history
  • Loading branch information
stof authored and michaelcullum committed Apr 6, 2019
1 parent 7bcfcb8 commit c69ed3b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Resources/views/Form/choice_widget_collapsed.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?php if (count($preferred_choices) > 0): ?>
<?php echo $view['form']->block($form, 'choice_widget_options', ['choices' => $preferred_choices]) ?>
<?php if (count($choices) > 0 && null !== $separator): ?>
<option disabled="disabled"><?php echo $separator ?></option>
<option disabled="disabled"><?php echo $view->escape($separator) ?></option>
<?php endif ?>
<?php endif ?>
<?php echo $view['form']->block($form, 'choice_widget_options', ['choices' => $choices]) ?>
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Form/form_errors.html.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php if (count($errors) > 0): ?>
<ul>
<?php foreach ($errors as $error): ?>
<li><?php echo $error->getMessage() ?></li>
<li><?php echo $view->escape($error->getMessage()) ?></li>
<?php endforeach; ?>
</ul>
<?php endif ?>
4 changes: 2 additions & 2 deletions Resources/views/Form/form_start.html.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $method = strtoupper($method) ?>
<?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?>
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>"<?php if ($action !== ''): ?> action="<?php echo $action ?>"<?php endif ?><?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>"<?php if ($action !== ''): ?> action="<?php echo $view->escape($action) ?>"<?php endif ?><?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
<?php if ($form_method !== $method): ?>
<input type="hidden" name="_method" value="<?php echo $method ?>" />
<input type="hidden" name="_method" value="<?php echo $view->escape($method) ?>" />
<?php endif ?>

0 comments on commit c69ed3b

Please sign in to comment.