Aaaarrrgh! Hard to trace programming errors.
I just spent an hour debugging the old “never forget to exit after sending your header redirect” error.
PEBKAC (my chair and my keyboard )…
SAFETY TIP:
Whenever you have code that looks like this:
<?php
header('Location: '.phpself());
?>
it must be followed by
<?php
exit;
?>
to prevent hard to track down unexpected results.