Skip to content

Comments

fix: Improve validation for submission answers with strict type checking#3178

Open
Chartman123 wants to merge 1 commit intomainfrom
fix/submit-checkboxes-with-strict-type-checking
Open

fix: Improve validation for submission answers with strict type checking#3178
Chartman123 wants to merge 1 commit intomainfrom
fix/submit-checkboxes-with-strict-type-checking

Conversation

@Chartman123
Copy link
Collaborator

@Chartman123 Chartman123 commented Feb 21, 2026

This fixes #3114 by improving the validation for strict type checks

Signed-off-by: Christian Hartmann chris-hartmann@gmx.de

@Chartman123 Chartman123 added bug Something isn't working php PHP related ticket 3. to review Waiting for reviews labels Feb 21, 2026
@Chartman123 Chartman123 self-assigned this Feb 21, 2026
@Chartman123 Chartman123 requested a review from susnux February 21, 2026 14:44
@Chartman123 Chartman123 force-pushed the fix/submit-checkboxes-with-strict-type-checking branch from 77adf9f to 237c39d Compare February 21, 2026 14:46
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
@Chartman123 Chartman123 force-pushed the fix/submit-checkboxes-with-strict-type-checking branch from 237c39d to c7ed599 Compare February 21, 2026 14:52
@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/Service/SubmissionService.php 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chartman123
Copy link
Collaborator Author

@gerbsen could you please test this fix?


// Check if all answers are within the possible options
if (in_array($question['type'], Constants::ANSWER_TYPES_PREDEFINED) && empty($question['extraSettings']['allowOtherAnswer'])) {
// Normalize option IDs once for consistent comparison (DB may return ints, request may send strings)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request may send strings

Do we do that? 👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, "other" answers only consist of strings...

@Chartman123
Copy link
Collaborator Author

/backport to stable5.2

@gerbsen
Copy link

gerbsen commented Feb 22, 2026

could you please test this fix?

Okay, I will. How would I do that? Going into the container and copy&replace the existing code?

@Chartman123
Copy link
Collaborator Author

Okay, I will. How would I do that? Going into the container and copy&replace the existing code?

Yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working feature: 📝 submitting responses php PHP related ticket

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Form with checkbox questions can't be submitted without 400 error

3 participants