Fixed PHP-1107: User lower socket time out during connection phase.
Fixed test case, and prevent segmentation faults.

Found while looking at Travis.
Merged pull request #717
Merge branch 'v1.5'
Extract php_mongo_selectdb() function from MongoClient::selectDB()
Add cursor namespace to log_query stream callback
PHP-1146: Refactor MONGO_METHOD calls in deprecated Mongo error methods

There was previously no test coverage for these deprecated methods, so basic tests were added to ensure a command is actually issued.
PHP-1145: Refactor MONGO_METHOD calls in MongoDBRef::get()
wip