PHP-1272 et al: Add missing bson_encode() tests and fix segfaults

 * https://jira.mongodb.org/browse/PHP-1272
 * https://jira.mongodb.org/browse/PHP-1273
 * https://jira.mongodb.org/browse/PHP-1277
I think we're on the same page here. When we call [`_estrndup()`](http://lxr.php.net/xref/PHP_5_6/Zend/zend_alloc.c#2641) with a length of 8, it actually allocates 8+1 bytes, copies exactly 8 bytes, and then sets the 9th byte to `\0`. The 9th byte of `buf` never gets used here. Either way, I don't see any harm in leaving it as-is.

> In fact, PHP will complain if they are not.

That's good to know, as I wouldn't have guessed just looking at the zval structure.