Newline being rendered, can't find out where from?

Hey, I’m running into an annoying issue and I’m looking to find a way to debug it. I’m generating a RSS feed for my blog by using the following plugin, I’ve used it before without any issues and I’m currently using 5.0.2 and Kirby 4.7.0.

After implementing everything and using a feed validator I noticed that there’s an extra newline on top of the output that makes the xml invalid (If it doesn’t start at byte 0 of the output).

~|⇒ curl http://localhost:8080/atom.xml

<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom">

I also verified that with a Hex editor where I can see that it’s a newline character.

The snippet I’m using to render the feed has no newlines and there’s no space in front of the php tags:

<?php
echo '<?xml version="1.0" encoding="utf-8"?>'; ?><feed xmlns="http://www.w3.org/2005/Atom">
    <title>The Hidden Blog</title>
    <link href="<?= $link ?>"/>

Now my question: Where do I best start debugging the render pipeline to figure out where this gets introduced?

Thanks!

I have identified the issue, I’ve looked for “hooks” in the code base as I suspected that it might be related to the plugin I have for logging 404s (“distantnative/retour-for-kirby”). It was not that one but I saw that my own helper plugin had a new line after the closing php tag.

I’ve since learned that this closing tag isn’t recommended anyway and removed it. If there’s a better way to find this without getting lucky I’d still be interested in a solution (and maybe others too that stumble upon this in the future).