Values are encoded consistently by the formbuilder and the htmlbuilder

This commit is contained in:
Stefan Printezis committed 2016-10-28 12:37:15 +02:00
1 parent abec449ed8
commit c1a105975b
4 files changed
+40 -15

No files matched your search

+4 -4
View File
@@ -485,7 +485,7 @@ class FormBuilder
// the element. Then we'll create the final textarea elements HTML for us.
$options = $this->html->attributes($options);
return $this->toHtmlString('<textarea' . $options . '>' . e($value) . '</textarea>');
return $this->toHtmlString('<textarea' . $options . '>' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '</textarea>');
}
/**
@@ -662,7 +662,7 @@ class FormBuilder
$html[] = $this->option($display, $value, $selected);
}
return $this->toHtmlString('<optgroup label="' . e($label) . '">' . implode('', $html) . '</optgroup>');
return $this->toHtmlString('<optgroup label="' . htmlentities($label, ENT_QUOTES, 'UTF-8') . '">' . implode('', $html) . '</optgroup>');
}
/**
@@ -680,7 +680,7 @@ class FormBuilder
$options = ['value' => $value, 'selected' => $selected];
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . htmlentities($display, ENT_QUOTES, 'UTF-8') . '</option>');
}
/**
@@ -698,7 +698,7 @@ class FormBuilder
$options = compact('selected');
$options['value'] = '';
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . e($display) . '</option>');
return $this->toHtmlString('<option' . $this->html->attributes($options) . '>' . htmlentities($display, ENT_QUOTES, 'UTF-8') . '</option>');
}
/**
+3 -3
View File
@@ -288,7 +288,7 @@ class HtmlBuilder
{
return str_repeat('&nbsp;', $num);
}
/**
* Generate an ordered list of items.
*
@@ -387,7 +387,7 @@ class HtmlBuilder
if (is_array($value)) {
return $this->nestedListing($key, $type, $value);
} else {
return '<li>' . e($value) . '</li>';
return '<li>' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '</li>';
}
}
@@ -449,7 +449,7 @@ class HtmlBuilder
}
if (! is_null($value)) {
return $key . '="' . e($value) . '"';
return $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8') . '"';
}
}