-
-
Save jmikola/5070358321f0cbc6fa57a09015986129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/MongoDB/BulkWrite.c b/src/MongoDB/BulkWrite.c | |
index 9a0a520..1b4e97c 100644 | |
--- a/src/MongoDB/BulkWrite.c | |
+++ b/src/MongoDB/BulkWrite.c | |
@@ -355,7 +355,40 @@ HashTable *php_phongo_bulkwrite_get_debug_info(zval *object, int *is_temp TSRMLS | |
ADD_ASSOC_NULL_EX(&retval, "write_concern"); | |
} | |
+ { | |
+ int i; | |
+ | |
+#if PHP_VERSION_ID >= 70000 | |
+ zval commands; | |
+ array_init(&commands); | |
+#else | |
+ zval *commands = NULL; | |
+ MAKE_STD_ZVAL(commands); | |
+ array_init(commands); | |
+#endif | |
+ | |
+ for (i = 0; i < intern->bulk->commands.len; i++) { | |
+ mongoc_write_command_t *command; | |
+ char *str; | |
+ size_t str_len; | |
+ | |
+ command = &_mongoc_array_index (&intern->bulk->commands, mongoc_write_command_t, i); | |
+ | |
+ str = bson_as_json(command->documents, &str_len); | |
+#if PHP_VERSION_ID >= 70000 | |
+ add_next_index_stringl(&commands, str, str_len); | |
+#else | |
+ add_next_index_stringl(commands, str, str_len, 1); | |
+#endif | |
+ bson_free(str); | |
+ } | |
+#if PHP_VERSION_ID >= 70000 | |
+ ADD_ASSOC_ZVAL_EX(&retval, "commands", &commands); | |
+#else | |
+ ADD_ASSOC_ZVAL_EX(&retval, "commands", commands); | |
+#endif | |
+ } | |
return Z_ARRVAL(retval); | |
} /* }}} */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment