diff --git a/src/Latte/Essential/Filters.php b/src/Latte/Essential/Filters.php index 97a1b3d3c..79336c8a8 100644 --- a/src/Latte/Essential/Filters.php +++ b/src/Latte/Essential/Filters.php @@ -265,7 +265,7 @@ public static function dataStream(string $data, ?string $type = null): string public static function breaklines(string|Stringable|null $s): Html { $s = htmlspecialchars((string) $s, ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8'); - return new Html(nl2br($s, Latte\Runtime\Filters::$xml)); + return new Html(nl2br($s, false)); } diff --git a/src/Latte/Runtime/Filters.php b/src/Latte/Runtime/Filters.php index 70ec04a9f..c6c9c9f45 100644 --- a/src/Latte/Runtime/Filters.php +++ b/src/Latte/Runtime/Filters.php @@ -24,9 +24,6 @@ class Filters /** @deprecated */ public static string $dateFormat = "j.\u{a0}n.\u{a0}Y"; - /** @internal use XML syntax? */ - public static bool $xml = false; - /** * Escapes string for use everywhere inside HTML (except for comments). diff --git a/src/Latte/Runtime/Template.php b/src/Latte/Runtime/Template.php index 5feca4734..94b4c266c 100644 --- a/src/Latte/Runtime/Template.php +++ b/src/Latte/Runtime/Template.php @@ -142,8 +142,6 @@ public function render(?string $block = null): void $this->parentName = ($this->global->coreParentFinder)($this); } - Filters::$xml = static::ContentType === Latte\ContentType::Xml; - if ($this->referenceType === 'import') { if ($this->parentName) { throw new Latte\RuntimeException('Imported template cannot use {extends} or {layout}, use {import}'); diff --git a/tests/filters/breaklines.phpt b/tests/filters/breaklines.phpt index 23f6efc41..1c9290a8f 100644 --- a/tests/filters/breaklines.phpt +++ b/tests/filters/breaklines.phpt @@ -7,7 +7,6 @@ declare(strict_types=1); use Latte\Essential\Filters; -use Latte\Runtime; use Latte\Runtime\Html; use Tester\Assert; @@ -16,10 +15,6 @@ require __DIR__ . '/../bootstrap.php'; $input = "Hello\nmy\r\nfriend\n\r"; -Runtime\Filters::$xml = true; -Assert::equal(new Html("Hello
\nmy
\r\nfriend
\n\r"), Filters::breaklines($input)); - -Runtime\Filters::$xml = false; Assert::equal(new Html("Hello
\nmy
\r\nfriend
\n\r"), Filters::breaklines($input)); Assert::equal(new Html("<>
\n&"), Filters::breaklines("<>\n&"));