From 1943f9d4173df4cb39992b960b870d5e41780348 Mon Sep 17 00:00:00 2001 From: Johannes Hammersen Date: Wed, 3 Jul 2024 04:23:25 +0200 Subject: [PATCH 1/2] FIX DBForeignKey scaffolding missing parameter (#11295) Co-authored-by: johannes.hammersen --- src/ORM/FieldType/DBForeignKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ORM/FieldType/DBForeignKey.php b/src/ORM/FieldType/DBForeignKey.php index 8b2aaa70b..6b5ef56f5 100644 --- a/src/ORM/FieldType/DBForeignKey.php +++ b/src/ORM/FieldType/DBForeignKey.php @@ -79,7 +79,7 @@ class DBForeignKey extends DBInt $list = DataList::create($hasOneClass); $threshold = static::config()->get('dropdown_field_threshold'); $overThreshold = $list->count() > $threshold; - $field = SearchableDropdownField::create($this->name, $title, $list, $labelField) + $field = SearchableDropdownField::create($this->name, $title, $list, null, $labelField) ->setIsLazyLoaded($overThreshold) ->setLazyLoadLimit($threshold); return $field; From c13ec34113737626058b8b68792c9e8c527dba5e Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:18:29 +1200 Subject: [PATCH 2/2] FIX Don't strip `
` tag from `HTMLValue` (#11302) --- src/View/Parsers/HTMLValue.php | 2 +- tests/php/View/Parsers/HTMLValueTest.php | 28 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/View/Parsers/HTMLValue.php b/src/View/Parsers/HTMLValue.php index ee44ec142..76b5ebc17 100644 --- a/src/View/Parsers/HTMLValue.php +++ b/src/View/Parsers/HTMLValue.php @@ -32,7 +32,7 @@ class HTMLValue extends ViewableData */ public function setContent($content) { - $content = preg_replace('#]*>#si', '', $content); + $content = preg_replace('#]*>#si', '', $content); $html5 = new HTML5(['disable_html_ns' => true]); $document = $html5->loadHTML( '' . diff --git a/tests/php/View/Parsers/HTMLValueTest.php b/tests/php/View/Parsers/HTMLValueTest.php index 7ce889dd7..52563498a 100644 --- a/tests/php/View/Parsers/HTMLValueTest.php +++ b/tests/php/View/Parsers/HTMLValueTest.php @@ -160,4 +160,32 @@ class HTMLValueTest extends SapphireTest $this->assertEquals($noscript, $value->getContent(), 'Child tags are left untouched in noscript tags.'); } } + + public function provideOnlyStripIntendedTags(): array + { + return [ + [ + 'input' => '

blahblah

', + 'expected' => '

blahblah

', + ], + [ + 'input' => '

blahblah

', + 'expected' => '

blahblah

', + ], + [ + 'input' => '

blahblah

', + 'expected' => '

blahblah

', + ], + ]; + } + + /** + * @dataProvider provideOnlyStripIntendedTags + */ + public function testOnlyStripIntendedTags(string $input, string $expected): void + { + $value = new HTMLValue(); + $value->setContent($input); + $this->assertEquals($expected, $value->getContent(), 'Invalid HTML can be parsed'); + } }