Hook 'page.update:after' new and old Page does not return in the exact same result even if they are unchanged


I have this Hook:

return [
'debug' => true,
'hooks' => [
    'page.update:after' => function ($newPage, $oldPage) {
        $pageName = $newPage->uid();
        $newField = json_encode($newPage->Addresses());
        $oldField = json_encode($oldPage->Addresses());
        // echo $newField;
        echo $oldField;
        // if old and new are equal then this returns true
        $resultCompare = strcmp($newField, $oldField) !== 1;
        echo $resultCompare;

        if ($pageName == 'offers' AND strcmp($newField, $oldField) !== 1) {
            $updateExcelsheet = New excelSheet();
            $updateExcelsheet->excelWrite($newPage, 'offersdatabackup.xlsx');
                'OffersdataLastupdate' => $newPage->modified()

$newField and $oldField did not change.
But when I compare the Strings of $newField and $oldField then I see Linebreak-Sign in one of both:

This means when I compare them with strcmp() this it always returns 1 instead of 0.
Is this a bug or is there something I did not understand about it?

The goal is to check if the structured field “addresses” has changed or not.

I solved it by a workaround.
I had to do this to remove \n on the $newField:
$newField = rtrim($newField, "\n");

I would define this as a Kirby Bug.
Please correct me if I’m wrong.