[WIP] PHP-1272: Fix bson_encode() segfaults with BSON type classes

https://jira.mongodb.org/browse/PHP-1272