@@ -190,7 +190,7 @@ void phongo_throw_exception_from_bson_error_t(bson_error_t* error TSRMLS_DC)
190190 zend_throw_exception (phongo_exception_from_mongoc_domain (error -> domain , error -> code ), error -> message , error -> code TSRMLS_CC );
191191}
192192
193- void phongo_throw_exception_from_bson_error_and_reply_t (bson_error_t * error , bson_t * reply TSRMLS_DC )
193+ void phongo_throw_exception_from_bson_error_t_and_reply (bson_error_t * error , const bson_t * reply TSRMLS_DC )
194194{
195195 /* Server errors (other than ExceededTimeLimit) and write concern errors
196196 * may use CommandException and report the result document for the
@@ -737,7 +737,7 @@ bool phongo_execute_bulk_write(mongoc_client_t* client, const char* namespace, p
737737 * returned and an exception is thrown. */
738738bool phongo_cursor_advance_and_check_for_error (mongoc_cursor_t * cursor TSRMLS_DC ) /* {{{ */
739739{
740- const bson_t * doc ;
740+ const bson_t * doc = NULL ;
741741
742742 if (!mongoc_cursor_next (cursor , & doc )) {
743743 bson_error_t error = { 0 };
@@ -748,8 +748,8 @@ bool phongo_cursor_advance_and_check_for_error(mongoc_cursor_t* cursor TSRMLS_DC
748748 }
749749
750750 /* Could simply be no docs, which is not an error */
751- if (mongoc_cursor_error (cursor , & error )) {
752- phongo_throw_exception_from_bson_error_t (& error TSRMLS_CC );
751+ if (mongoc_cursor_error_document (cursor , & error , & doc )) {
752+ phongo_throw_exception_from_bson_error_t_and_reply (& error , doc TSRMLS_CC );
753753 return false;
754754 }
755755 }
@@ -966,7 +966,7 @@ bool phongo_execute_command(mongoc_client_t* client, php_phongo_command_type_t t
966966 free_reply = true;
967967
968968 if (!result ) {
969- phongo_throw_exception_from_bson_error_and_reply_t (& error , & reply TSRMLS_CC );
969+ phongo_throw_exception_from_bson_error_t_and_reply (& error , & reply TSRMLS_CC );
970970 goto cleanup ;
971971 }
972972
0 commit comments