Whoops... forgot to add... This is Revo 2.2.4
Is there any way the snippet could be running twice (say, a snippet tag in the $output)? That would explain what you're seeing.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html
The snippet isn't running twice. The output is just a string of html, and the snippet is only getting called once on the page... in fact, there isn't much else to the page but the snippet.
How do you know it is not running twice?
I ask because I had a very simple snippet that was meant to count page views, but would often not run and sometimes would run twice! I never did get to the bottom of it - was not worth the time.
For testing purposes try an echo or print_r() before the unset and see what happens - this not a solution but just for testing!
That does sound weird. I will give the echo a go and see if it is doing something funky. I can't imagine, though, why it would be running twice based on my code, thus if it is running twice, I don't think I would know how to fix it—if it were even possible. I'll post again shortly with the results.
I should have noted that my simple snippet to count page views worked flawlessly for 6-9 months, so it was probably an modx upgrade that resulted in it not counting - I suspect it has something to do with cache but I am really not sure and so do not want to lay any blame.
Do any of the variables you're returning in the output contain the snippet tag? That would also explain what you're seeing.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html