From b1ca3497776c95961473047079d71016c9dacc24 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Tue, 17 Nov 2026 14:28:21 +0100 Subject: [PATCH] fix(submission): count the same titles as blank as the submit view A question title made only of U+0085 (next line) or U+180E (Mongolian vowel separator) counted as blank on the server, as \s matches them in Unicode mode, while the submit view shows such a question, as JavaScript's trim() keeps both. The server now counts exactly the characters as blank that trim() removes, so a required question with such a title needs an answer, as in the submit view. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger --- lib/Service/SubmissionService.php | 2 +- tests/Unit/Service/SubmissionServiceTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 237abbf74..503dfe94b 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -600,7 +600,7 @@ private function escapeCSV(string $value): string { * @param array $question the question with its options */ private static function isShownToRespondents(array $question): bool { - if (preg_match('/^[\s\p{Z}\x{FEFF}]*$/u', (string)($question['text'] ?? '')) === 1) { + if (preg_match('/^[\t\n\x0B\f\r\p{Z}\x{FEFF}]*$/u', (string)($question['text'] ?? '')) === 1) { return false; } diff --git a/tests/Unit/Service/SubmissionServiceTest.php b/tests/Unit/Service/SubmissionServiceTest.php index dffeb0d44..fa3430b82 100644 --- a/tests/Unit/Service/SubmissionServiceTest.php +++ b/tests/Unit/Service/SubmissionServiceTest.php @@ -939,6 +939,13 @@ public static function dataValidateSubmission() { [], null, ], + 'required-with-next-line-title-is-shown' => [ + [ + ['id' => 1, 'type' => 'short', 'text' => "\u{0085}\u{180E}", 'isRequired' => true] + ], + [], + "Question \"\u{0085}\u{180E}\" is required.", + ], 'required-choice-without-options-is-not-shown' => [ [ ['id' => 1, 'type' => 'multiple_unique', 'text' => 'q1', 'isRequired' => true, 'options' => []]