diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index c95a9f4f9999..b4335fe90059 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -253,13 +253,7 @@ protected function compareDates($attribute, $value, $parameters, $operator) } if (is_null($date = $this->getDateTimestamp($parameters[0]))) { - $comparedValue = $this->getValue($parameters[0]); - - if (! is_string($comparedValue) && ! is_numeric($comparedValue) && ! $comparedValue instanceof DateTimeInterface) { - return false; - } - - $date = $this->getDateTimestamp($comparedValue); + $date = $this->getDateTimestamp($this->getValue($parameters[0])); } return $this->compare($this->getDateTimestamp($value), $date, $operator); diff --git a/tests/Validation/ValidationValidatorTest.php b/tests/Validation/ValidationValidatorTest.php index e351c118eb30..7c9d7b31d3a2 100755 --- a/tests/Validation/ValidationValidatorTest.php +++ b/tests/Validation/ValidationValidatorTest.php @@ -5980,12 +5980,6 @@ public function testBeforeAndAfter() $v = new Validator($trans, ['x' => '0001-01-01T00:00'], ['x' => 'after:1970-01-01']); $this->assertTrue($v->fails()); - - $v = new Validator($trans, ['x' => ['a' => ['v' => 'c']], 'y' => 'invalid'], ['x' => 'date', 'y' => 'date|after:x']); - $this->assertTrue($v->fails()); - - $v = new Validator($trans, ['x' => ['a' => ['v' => 'c']], 'y' => 'invalid'], ['x' => 'date', 'y' => 'date|before:x']); - $this->assertTrue($v->fails()); } public function testBeforeAndAfterWithFormat()