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
For what it's worth, MongoTimestamp's constructor doesn't seem to validate that its arguments are 32-bit integers. That seems like a problem worth tracking in another JIRA issue (not to be fixed in this PR). Thoughts?