Drop database before insertion in MongoDB::drop() test

Previously, this test would fail if the test collection existed with documents. Start the test by dropping the database, and also use the default test database name.
Merge pull request #546
Make sure to check return values

Without this, and throwing an exception things will crash.
Added the cursor_allowed flag, so that we can reuse runcommand for cursor-commands too.
Added comments and vim folding lines.
Moved the error checking to a non-static function.

Also fixed the error codes.
Allow for special cursor and bson_to_zval options, to force Long -> object

This is necessary because in some cases we need to guarantee that we have an
Int64. For example the cursor ID comming back from a "command cursor" query.
Without this we can't reliably get the correct int64 number, as we can not
allow this to depend on ini settings.
Implement the function that reads the cursor ID from the returned document.

It's by certain an int64, as we forced that earlier.
Move strtoll() definition so that it can be used everywhere.
Fixed typo.
Refactor the command cursor flag to be part of cursor_options.
We only should force this for command cursors, otherwise we change expected output for normal commands.
Refactor force_primary to a cursor_option as well.
Integrate comments from review.
Name function properly.
Fixed those tests, as we now have better error codes.
Merged pull request #545
Added a test case for PHP-925, and also allow test to pick a master or secondary from a set.

It specifically does not return the full isMaster output, as the printjson
function outputs *extended* JSON, which includes things like ISODate. And of
course PHP's json_decode() can't do anything with this.
Fixed PHP-925: Reading a GridFS file from a secondary server using PHP requires write access.
Use sys_get_temp_dir() as per review.