diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 43dba65df..df5e9f1c1 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -591,7 +591,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 17ce3fdfd..4ffb7c4b4 100644 --- a/tests/Unit/Service/SubmissionServiceTest.php +++ b/tests/Unit/Service/SubmissionServiceTest.php @@ -827,6 +827,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' => []]