Skip to content

Commit

Permalink
Fixed #14498
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 1, 2024
1 parent efd8418 commit 8afe137
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed a bug where some characters were getting misinterpreted as elisions when normalizing search keywords.
- Fixed a bug where `craft\helpers\UrlHelper::actionUrl()` was using the site URL rather than the requested URL. ([#14440](https://github.com/craftcms/cms/issues/14440))
- Fixed a bug where `craft\helpers\Html::parseTagAttribute()` wasn’t handling attribute values with newlines. ([#14498](https://github.com/craftcms/cms/issues/14498))

## 4.8.0 - 2024-02-26

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public static function parseTagAttribute(string $html, int $offset = 0, ?int &$s
// Wrapped in quotes?
if (isset($html[$offset]) && in_array($html[$offset], ['\'', '"'])) {
$q = preg_quote($html[$offset], '/');
if (!preg_match("/$q(.*?)$q/A", $html, $m, 0, $offset)) {
if (!preg_match("/$q(.*?)$q/sA", $html, $m, 0, $offset)) {
// No matching end quote
throw new InvalidArgumentException("Malformed HTML tag attribute in string: $html");
}
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/helpers/HtmlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ public function parseTagAttributesDataProvider(): array
[false, "<div x-foo='>"],
[false, '<!-- comment -->'],
[false, '<?xml?>'],
// https://github.com/craftcms/cms/issues/14498
[['data' => ['label' => "foo\n\nbar"]], "<div data-label=\"foo\n\nbar\">"],
];
}

Expand Down

0 comments on commit 8afe137

Please sign in to comment.