Skip to content
This repository has been archived by the owner on Nov 27, 2021. It is now read-only.

Commit

Permalink
When checking for 'selected' always cast to a string, because there's…
Browse files Browse the repository at this point in the history
… no other datatype that can be represented uniqely in an html attribute.
  • Loading branch information
toomuchpete committed Apr 12, 2012
1 parent 7635a4b commit 4239f09
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions template/helper/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,7 @@ protected function _selectOptions(array $list, array $scope) {
}
$selected = (
(is_array($scope['value']) && in_array($value, $scope['value'])) ||
($scope['empty'] && empty($scope['value']) && $value === '') ||
($scope['value'] === (is_integer($value) ? (string) $value : $value) )
((string) $scope['value'] === (string) $value)
);
$options = $selected ? array('selected' => true) : array();
$params = compact('value', 'title', 'options');
Expand Down

0 comments on commit 4239f09

Please sign in to comment.