Permalink
Browse files

allow null values to trigger hasChanged() assertion

`isset($properties[$property])` returns false when the value is null.
null is a legitimate change for a database field.
switching to `array_key_exists()` fixes this.
  • Loading branch information...
1 parent c830d94 commit 8139ddc19b3d93468ad164695df68a291a867b25 @saetia committed May 13, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 RedBean/OODBBean.php
View
@@ -780,9 +780,9 @@ public function isTainted() {
*
* @return boolean
*/
- public function hasChanged($property) {
- if (!isset($this->properties[$property])) return false;
- return ($this->old($property) != $this->properties[$property]);
+ public function hasChanged($property){
+ return (array_key_exists($property, $this->properties)) ?
+ $this->old($property) != $this->properties[$property] : false;
}
/**
* Creates a N-M relation by linking an intermediate bean.

0 comments on commit 8139ddc

Please sign in to comment.