diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 029d45637c63..991f06434a5b 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -2101,7 +2101,7 @@ public function originalIsEquivalent($key) } return is_numeric($attribute) && is_numeric($original) - && BigDecimal::of($attribute)->isEqualTo($original); + && strcmp((string) $attribute, (string) $original) === 0; } /** diff --git a/tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php b/tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php index bfa3d533514b..8bbdb68c0271 100644 --- a/tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php +++ b/tests/Integration/Database/DatabaseEloquentModelCustomCastingTest.php @@ -169,33 +169,6 @@ public function testDeviableCasts() $this->assertSame((new Decimal('320.988'))->getValue(), $model->price->getValue()); } - public function testDirtyOnCustomNumericCasts() - { - $model = new TestEloquentModelWithCustomCast; - $model->price = '123.00'; - $model->save(); - - $this->assertFalse($model->isDirty()); - - $model->price = '123.00'; - $this->assertFalse($model->isDirty('price')); - - $model->price = '123.0'; - $this->assertFalse($model->isDirty('price')); - - $model->price = '123'; - $this->assertFalse($model->isDirty('price')); - - $model->price = '00123.00'; - $this->assertFalse($model->isDirty('price')); - - $model->price = '123.4000'; - $this->assertTrue($model->isDirty('price')); - - $model->price = '123.0004'; - $this->assertTrue($model->isDirty('price')); - } - public function testSerializableCasts() { $model = new TestEloquentModelWithCustomCast;