Author: Shivam Mathur (shivammathur)
Date: 2025-02-14T07:10:42+05:30
Commit: Fix parsing regex validation rules · php/web-downloads@03bc2cb · GitHub
Raw diff: https://github.com/php/web-downloads/commit/03bc2cbb8e028e89fbb793b2612f819170ba4a98.diff
Fix parsing regex validation rules
Changed paths:
M src/Validator.php
Diff:
diff --git a/src/Validator.php b/src/Validator.php
index 1330f95..db2dc56 100644
--- a/src/Validator.php
+++ b/src/Validator.php
@@ -22,7 +22,7 @@ public function validate(array $data): void
foreach ($this->rules as $field => $ruleString) {
$rulesArray = explode('|', $ruleString);
foreach ($rulesArray as $rule) {
- $ruleParts = explode(':', $rule);
+ $ruleParts = explode(':', $rule, 2);
$ruleName = $ruleParts[0];
$ruleValue = $ruleParts[1] ?? null;