| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cf4c435 commit 92a3b24
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn | |||
| 25 | 25 | * | |
| 26 | 26 | * @var string | |
| 27 | 27 | */ | |
| 28 | - const VERSION = '5.2.1'; | ||
| 28 | + const VERSION = '5.2.2'; | ||
| 29 | 29 | ||
| 30 | 30 | /** | |
| 31 | 31 | * The base path for the Laravel installation. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -806,7 +806,7 @@ protected function validateArray($attribute, $value) | |||
| 806 | 806 | return true; | |
| 807 | 807 | } | |
| 808 | 808 | ||
| 809 | - return is_array($value); | ||
| 809 | + return is_null($value) || is_array($value); | ||
| 810 | 810 | } | |
| 811 | 811 | ||
| 812 | 812 | /** | |
@@ -824,7 +824,7 @@ protected function validateBoolean($attribute, $value) | |||
| 824 | 824 | ||
| 825 | 825 | $acceptable = [true, false, 0, 1, '0', '1']; | |
| 826 | 826 | ||
| 827 | - return in_array($value, $acceptable, true); | ||
| 827 | + return is_null($value) || in_array($value, $acceptable, true); | ||
| 828 | 828 | } | |
| 829 | 829 | ||
| 830 | 830 | /** | |
@@ -840,7 +840,7 @@ protected function validateInteger($attribute, $value) | |||
| 840 | 840 | return true; | |
| 841 | 841 | } | |
| 842 | 842 | ||
| 843 | - return filter_var($value, FILTER_VALIDATE_INT) !== false; | ||
| 843 | + return is_null($value) || filter_var($value, FILTER_VALIDATE_INT) !== false; | ||
| 844 | 844 | } | |
| 845 | 845 | ||
| 846 | 846 | /** | |
@@ -856,7 +856,7 @@ protected function validateNumeric($attribute, $value) | |||
| 856 | 856 | return true; | |
| 857 | 857 | } | |
| 858 | 858 | ||
| 859 | - return is_numeric($value); | ||
| 859 | + return is_null($value) || is_numeric($value); | ||
| 860 | 860 | } | |
| 861 | 861 | ||
| 862 | 862 | /** | |
@@ -872,7 +872,7 @@ protected function validateString($attribute, $value) | |||
| 872 | 872 | return true; | |
| 873 | 873 | } | |
| 874 | 874 | ||
| 875 | - return is_string($value); | ||
| 875 | + return is_null($value) || is_string($value); | ||
| 876 | 876 | } | |
| 877 | 877 | ||
| 878 | 878 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1874,8 +1874,14 @@ public function testThatPrimitiveTypesAreImplicitAndMustBeCorrectIfDataIsPresent | |||
| 1874 | 1874 | $v = new Validator($trans, [], ['foo' => 'numeric']); | |
| 1875 | 1875 | $this->assertTrue($v->passes()); | |
| 1876 | 1876 | ||
| 1877 | + // Allow null on these rules unless required | ||
| 1877 | 1878 | $trans = $this->getRealTranslator(); | |
| 1878 | 1879 | $v = new Validator($trans, ['foo' => null], ['foo' => 'numeric']); | |
| 1880 | + $this->assertFalse($v->fails()); | ||
| 1881 | + | ||
| 1882 | + // Allow null on these rules unless required | ||
| 1883 | + $trans = $this->getRealTranslator(); | ||
| 1884 | + $v = new Validator($trans, ['foo' => null], ['foo' => 'required|numeric']); | ||
| 1879 | 1885 | $this->assertTrue($v->fails()); | |
| 1880 | 1886 | ||
| 1881 | 1887 | $trans = $this->getRealTranslator(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments