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
This test is exactly `bson_encode-006.phpt` (i.e. the array test), except for this `(object)` cast. Since `bson_encode()` is only returning the value payload that occurs after the type discriminator byte, arrays and objects are identical.