Browse Source

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.
Bernardo Rittmeyer 11 years ago
parent
commit
d46e19214b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      laravel/database/eloquent/model.php

+ 2 - 2
laravel/database/eloquent/model.php

@@ -517,7 +517,7 @@ abstract class Model {
 
 		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 @@ abstract class Model {
 		return call_user_func_array(array(new $model, $method), $parameters);
 	}
 
-}
+}