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.
This commit is contained in:
parent
5dd3ec6f1e
commit
d46e19214b
|
@ -517,7 +517,7 @@ public function get_dirty()
|
||||||
|
|
||||||
foreach ($this->attributes as $key => $value)
|
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;
|
$dirty[$key] = $value;
|
||||||
}
|
}
|
||||||
|
@ -795,4 +795,4 @@ public static function __callStatic($method, $parameters)
|
||||||
return call_user_func_array(array(new $model, $method), $parameters);
|
return call_user_func_array(array(new $model, $method), $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue