Page update after hook

Hi,

not sure if i am totally confused here but inside a page.update:after hook i want to check if a field is updated. i do this via a simple if statement

if($newPage->weitere_personen() === $oldPage->weitere_personen()) {
  //do stuff
}
else {
  //do other stuff
}

The field is a tags field. My problem is that everytime i update the page the hook says i change the field – even if it’s empty.

Do i missing something here?

Greetings
David

You need to compare the field values, not the field objects.

if($newPage->weitere_personen()->value() === $oldPage->weitere_personen()->value()) {
  //do stuff
}

That you! Works perfect now.