[web-downloads] main: Fix parsing regex validation rules
| From: | Shivam Mathur | Date: | Fri, 14 Feb 2025 01:48:25 +0000 |
| Subject: | [web-downloads] main: Fix parsing regex validation rules | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-32698@lists.php.net to get a copy of this message | ||
Author: Shivam Mathur (shivammathur)
Date: 2025-02-14T07:10:42+05:30
Commit: https://github.com/php/web-downloads/commit/03bc2cbb8e028e89fbb793b2612f819170ba4a98
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;