Skip to content

Commit f292c6c

Browse files
committed
bug fixed for validate the 'phone'
1 parent 2b6a916 commit f292c6c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ValidatorList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public static function compare($var, $compareVar)
366366

367367
public static function phone($value)
368368
{
369-
return preg_match(
369+
return 1 === preg_match(
370370
'/^(?:(?:1(?:3[4-9]|5[012789]|8[78])\d{8}|1(?:3[0-2]|5[56]|8[56])\d{8}|18[0-9]\d{8}|1[35]3\d{8})|14[57]\d{8}|170[059]\d{7}|17\d{9})$/',
371371
$value
372372
);
@@ -395,7 +395,7 @@ public static function postCode($postcode)
395395
*/
396396
public static function price($price)
397397
{
398-
return preg_match('/^[\d]{1,10}(\.[\d]{1,9})?$/', $price);
398+
return 1 === preg_match('/^[\d]{1,10}(\.[\d]{1,9})?$/', $price);
399399
}
400400

401401
/**
@@ -405,7 +405,7 @@ public static function price($price)
405405
*/
406406
public static function negativePrice($price)
407407
{
408-
return preg_match('/^[-]?[\d]{1,10}(\.[\d]{1,9})?$/', $price);
408+
return 1 === preg_match('/^[-]?[\d]{1,10}(\.[\d]{1,9})?$/', $price);
409409
}
410410

411411
/**

0 commit comments

Comments
 (0)