Skip to content

Commit

Permalink
Merge pull request #18 from rhertogh/patch-1
Browse files Browse the repository at this point in the history
Fixed AuditTrailBehavior::onAfterUpdate() for PHP 8.1
  • Loading branch information
Isitar (Pascal Lüscher) authored Mar 21, 2023
2 parents 0dd242c + 5df4024 commit 29fa678
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

###### v.1.0.3
- fixed AuditTrailBehavior::onAfterUpdate() for PHP 8.1

###### v.1.0.2
- fixed bug in AuditTrail widget

Expand Down
2 changes: 1 addition & 1 deletion behaviors/AuditTrailBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function onAfterUpdate($event)
$newVal = static::castValue($oldVal, $this->owner->{$attrName});

//additional comparison after casting
if ((is_string($newVal) && call_user_func($this->caseSensitive ? 'strcmp' : 'strcasecmp', $oldVal, $newVal) === 0) || $oldVal === $newVal) {
if ($oldVal === $newVal || (is_string($newVal) && is_string($oldVal) && call_user_func($this->caseSensitive ? 'strcmp' : 'strcasecmp', $oldVal, $newVal) === 0)) {
continue;
}

Expand Down

0 comments on commit 29fa678

Please sign in to comment.