Commit 5f99c810 authored by JoostK's avatar JoostK

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`.
parent 8004d482
......@@ -518,7 +518,7 @@ abstract class Model {
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment