Skip to content

Commit bf3cb6f

Browse files
committed
revert change to float casting
1 parent 3e7e9b2 commit bf3cb6f

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,11 +1178,6 @@ public function originalIsEquivalent($key, $current)
11781178
} elseif ($this->hasCast($key, ['object', 'collection'])) {
11791179
return $this->castAttribute($key, $current) ==
11801180
$this->castAttribute($key, $original);
1181-
} elseif ($this->hasCast($key, ['real', 'float', 'double'])) {
1182-
return bccomp(
1183-
$this->castAttribute($key, $current),
1184-
$this->castAttribute($key, $original)
1185-
) === 0;
11861181
} elseif ($this->hasCast($key)) {
11871182
return $this->castAttribute($key, $current) ===
11881183
$this->castAttribute($key, $original);

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,6 @@ public function testCleanAttributes()
148148
$this->assertFalse($model->isClean(['foo', 'bar']));
149149
}
150150

151-
public function testCleanWhenFloatUpdateAttribute()
152-
{
153-
$original = -16.666347;
154-
$new = 20.1 - 36.766347;
155-
156-
$this->assertFalse($original === $new);
157-
$this->assertSame(0, bccomp($original, $new));
158-
159-
$model = new EloquentModelStub(['castedFloat' => $original]);
160-
$model->syncOriginal();
161-
$this->assertTrue($model->originalIsEquivalent('castedFloat', $new));
162-
}
163-
164151
public function testCalculatedAttributes()
165152
{
166153
$model = new EloquentModelStub;
@@ -2005,7 +1992,6 @@ class EloquentModelStub extends Model
20051992
protected $table = 'stub';
20061993
protected $guarded = [];
20071994
protected $morph_to_stub_type = EloquentModelSaveStub::class;
2008-
protected $casts = ['castedFloat' => 'float'];
20091995

20101996
public function getListItemsAttribute($value)
20111997
{

0 commit comments

Comments
 (0)