Is this a bug or should I be taking some precautions when using apostrophes in users names?
Yes, you should indeed take precautions when using apostrophes in users names because it is a bug that has apparently not been fixed yet

This is something I need to fix upstream. So thanks for the note, I'll create a bug upstream and fix it.
Cheers,
Gunnar