PHP-1272: Fix segfault with bson_encode() and MongoDate
PHP-1273: Fix bson_encode() handling of MongoTimestamp objects

Previously, MongoTimestamp objects were serialized as BSON dates, which also lead to property access errors.

Additionally, this changes the code to use a static buffer, which is consistent with other fixed-size types (e.g. dates, integers).
PHP-1277: bson_encode() should return empty string for min/max keys

MongoMinKey and MongoMaxKey do not have values and are only differentiated by the type byte in a document (like null values).
PHP-1272: Implement missing tests for bson_encode()
Merge pull request #763
Do not try to authenticate when no credentials are set.
Set error_message in every case we return 0.
Mark these functions as static, as they are not used outside this file.
Fixed CS issues.