[web-downloads] main: Add null check in Validator::regex

From: Date: Thu, 02 Apr 2026 01:27:58 +0000
Subject: [web-downloads] main: Add null check in Validator::regex
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-33634@lists.php.net to get a copy of this message
Author: Shivam Mathur (shivammathur) Date: 2026-04-02T06:12:30+05:30 Commit: https://github.com/php/web-downloads/commit/df12651064b012cd0c9324a53affc0ee36280d28 Raw diff: https://github.com/php/web-downloads/commit/df12651064b012cd0c9324a53affc0ee36280d28.diff Add null check in Validator::regex Changed paths: M src/Validator.php Diff: diff --git a/src/Validator.php b/src/Validator.php index 298cbd8..164720f 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -82,7 +82,7 @@ protected function string($value): bool protected function regex($value, $pattern): bool { - return preg_match($pattern, $value) === 1; + return is_string($value) && preg_match($pattern, $value) === 1; } protected function getErrorMessage($field, $rule, $value): string

« previous php.webmaster (#33634) next »