Skip to content

Commit 7f1a109

Browse files
Merge branch '6.x' into 7.x
2 parents de1d159 + 0c2e28e commit 7f1a109

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGELOG-6.x.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Release Notes for 6.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v6.18.22...6.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v6.18.23...6.x)
4+
5+
### Fixed
6+
- Fixed notifications database channel for anonymous notifiables ([#33409](https://github.com/laravel/framework/pull/33409))
7+
- Added float comparison null checks ([#33421](https://github.com/laravel/framework/pull/33421))
8+
9+
10+
## [v6.18.23 (2020-06-30)](https://github.com/laravel/framework/compare/v6.18.22...v6.18.23)
11+
12+
### Fixed
13+
- Fixed `ConfigurationUrlParser` query decoding ([#33340](https://github.com/laravel/framework/pull/33340))
14+
- Correct implementation of float casting comparison ([#33322](https://github.com/laravel/framework/pull/33322))
415

516

617
## [v6.18.22 (2020-06-24)](https://github.com/laravel/framework/compare/v6.18.21...v6.18.22)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,10 @@ public function originalIsEquivalent($key)
14121412
return $this->castAttribute($key, $attribute) ==
14131413
$this->castAttribute($key, $original);
14141414
} elseif ($this->hasCast($key, ['real', 'float', 'double'])) {
1415+
if (($attribute === null && $original !== null) || ($attribute !== null && $original === null)) {
1416+
return false;
1417+
}
1418+
14151419
return abs($this->castAttribute($key, $attribute) - $this->castAttribute($key, $original)) < PHP_FLOAT_EPSILON * 4;
14161420
} elseif ($this->hasCast($key, static::$primitiveCastTypes)) {
14171421
return $this->castAttribute($key, $attribute) ===

tests/Database/DatabaseEloquentModelTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ public function testIntAndNullComparisonWhenDirty()
102102
$this->assertTrue($model->isDirty('intAttribute'));
103103
}
104104

105+
public function testFloatAndNullComparisonWhenDirty()
106+
{
107+
$model = new EloquentModelCastingStub();
108+
$model->floatAttribute = null;
109+
$model->syncOriginal();
110+
$this->assertFalse($model->isDirty('floatAttribute'));
111+
$model->forceFill(['floatAttribute' => 0.0]);
112+
$this->assertTrue($model->isDirty('floatAttribute'));
113+
}
114+
105115
public function testDirtyOnCastOrDateAttributes()
106116
{
107117
$model = new EloquentModelCastingStub;

0 commit comments

Comments
 (0)