You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -562,21 +562,22 @@ public function validateSubmission(array $questions, array $answers, string $for
562
562
thrownew \InvalidArgumentException(sprintf('The answer for question "%s" must be an integer between %d and %d.', $question['text'], $optionsLowest, $optionsHighest));
563
563
}
564
564
}
565
+
// Check if all grid rows, columns and values match the configured grid subtype
if ($answerId === null || (string)$answerId !== (string)intval($answerId)) {
574
-
thrownew \InvalidArgumentException(sprintf('Answer "%s" for question "%s" is not a valid option.', is_scalar($subAnswer) ? (string)$subAnswer : gettype($subAnswer), $question['text']));
575
-
}
571
+
// Accept numeric strings like "46" from JSON payloads reliably (e.g. with hardening extensions enabled)
thrownew \InvalidArgumentException(sprintf('Answer "%s" for question "%s" is not a valid option.', $subAnswer, $question['text']));
579
-
}
574
+
// Reject non-numeric / malformed values early
575
+
if ($answerId === null || (string)$answerId !== (string)intval($answerId)) {
576
+
thrownew \InvalidArgumentException(sprintf('Answer "%s" for question "%s" is not a valid option.', is_scalar($answer) ? (string)$answer : gettype($answer), $question['text']));
577
+
}
578
+
579
+
if (!in_array($answerId, $optionIds, true)) {
580
+
thrownew \InvalidArgumentException(sprintf('Answer "%s" for question "%s" is not a valid option.', $answer, $question['text']));
if ($normalizedColumnId === null || !in_array($normalizedColumnId, $columnIds, true)) {
737
+
thrownew \InvalidArgumentException(sprintf('Column "%s" for question "%s" is not a valid option.', $columnId, $question['text']));
738
+
}
739
+
if ($value !== '' && !is_numeric($value)) {
740
+
thrownew \InvalidArgumentException(sprintf('Answer "%s" for question "%s" must be a number.', is_scalar($value) ? (string)$value : gettype($value), $question['text']));
741
+
}
742
+
}
743
+
continue;
744
+
} else {
745
+
thrownew \InvalidArgumentException(sprintf('Invalid grid type for question "%s".', $question['text']));
thrownew \InvalidArgumentException(sprintf('Column "%s" for question "%s" is not a valid option.', is_scalar($columnId) ? (string)$columnId : gettype($columnId), $question['text']));
0 commit comments