Skip to content

Improved get dirty attr value get method:#220

Merged
techmahedy merged 3 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x
Mar 11, 2026
Merged

Improved get dirty attr value get method:#220
techmahedy merged 3 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Member

Improved get dirty attr value get method:

@rrr63
Copy link
Member

rrr63 commented Mar 11, 2026

Could removing the array_key_exists check cause an undefined array key error when the key isn’t present in the array?

@techmahedy
Copy link
Member Author

@rrr63 You are right

if (
      !array_key_exists($key, $this->originalAttributes) ||
      !$this->valuesAreEqual($this->originalAttributes[$key], $value)
  ) {
      $dirty[$key] = $value;
  }

this is safe

@techmahedy techmahedy merged commit bd4642b into doppar:3.x Mar 11, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants