From d46e19214bd66c54b7daec62d4bc62b70c74d031 Mon Sep 17 00:00:00 2001 From: Bernardo Rittmeyer Date: Thu, 4 Apr 2013 12:50:59 +0300 Subject: [PATCH] get_dirty() comparison is not type safe get_dirty() must compare using Not Identical (!==) on place of Not Equal (!=). For example, changing null to false don't make the model dirty. --- laravel/database/eloquent/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index cb555de4..23d25b02 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -517,7 +517,7 @@ public function get_dirty() foreach ($this->attributes as $key => $value) { - if ( ! array_key_exists($key, $this->original) or $value != $this->original[$key]) + if ( ! array_key_exists($key, $this->original) or $value !== $this->original[$key]) { $dirty[$key] = $value; } @@ -795,4 +795,4 @@ public static function __callStatic($method, $parameters) return call_user_func_array(array(new $model, $method), $parameters); } -} \ No newline at end of file +}