PHP-1249: MongoCursor::count() should use cursor's socket timeout
Merge pull request #746
Merge branch 'v1.5'
PHP-1160: Support MongoCollection::count() $options array

Scalar limit/skip option arguments are still supported, but $options array will allow "hint" option to be specified.

Require an array or object for MongoCollection::count() $query arg. Previously, an invalid type for this argument was ignored and passed through to the server (where it was likely ignored). The lack of validation may have been an oversight, or done purposely so that null could be specified as a convenience if the user only wanted to provide limit/skip scalar arguments.
Test MongoCursor::count() $foundOnly with limit/skip options
PHP-1160: Ensure MongoCursor hint is passed to count command
PHP-1160: Omit empty query hashes from count commands

When calling MongoCollection::count() with an empty $query argument, an empty array would be serialized as a BSON array and trigger a validation error on MongoDB 2.7.7. If the $query argument is an empty hash, simply omit it from the command.

This is generally not a problem for MongoCursor::count(), since its constructor detects an empty query argument; however, it could still happen if the query is modified after the fact.

Note: SERVER-15456 relaxed validation of the query option in 2.7.8, but it shouldn't hurt to have these precautions in the driver.
PHP-1160: Update MongoCollection::count() arginfo