Type juggling can be quite tricky and lead to unexpected results as you did perfectly describe in your blog post. One should always check the manual to see the different type of return values and react accordingly.

Another pro tip: write a wrapper function for that behaviour and call that in your code :)