From 5f99c81035523e097a54fa6290de7b233c6691c3 Mon Sep 17 00:00:00 2001 From: JoostK Date: Sun, 9 Sep 2012 20:52:33 +0200 Subject: [PATCH] Fixed a problem whith `Eloquent::get_dirty` When you had a synched Eloquent model (e.g. without changed values) but one of those values is `null`, then that value would be considered as dirty. `Eloquent::changed` returns false, but the value is present in `Eloquent::get_dirty`. This fix makes sure that a `null` value in `$attributes` is only present in `get_dirty` when it wasn't at all *set* in `$original`. --- laravel/database/eloquent/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index 306d471a..645937f5 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -518,7 +518,7 @@ public function get_dirty() foreach ($this->attributes as $key => $value) { - if ( ! isset($this->original[$key]) or $value !== $this->original[$key]) + if ( ! array_key_exists($key, $this->original) or $value != $this->original[$key]) { $dirty[$key] = $value; }