Skip to content

Commit 06f6080

Browse files
committed
Move up client argument for phongo_parse_session()
Client is required, while the opts and zval arguments are optional.
1 parent 7622c08 commit 06f6080

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

php_phongo.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,13 @@ bool phongo_parse_read_preference(zval *options, zval **zreadPreference TSRMLS_D
540540
return true;
541541
} /* }}} */
542542

543-
/* Parses the "session" option for an execute method. If mongoc_opts is not
544-
* NULL, the option will be appended. If zsession is not NULL, it will be
543+
/* Parses the "session" option for an execute method. The client object should
544+
* correspond to the Manager executing the operation and will be used to ensure
545+
* that the session is correctly associated with that client. If mongoc_opts is
546+
* not NULL, the option will be appended. If zsession is not NULL, it will be
545547
* assigned to the option. On error, false is returned and an exception is
546548
* thrown. */
547-
static bool phongo_parse_session(zval *options, bson_t *mongoc_opts, zval **zsession, mongoc_client_t *client TSRMLS_DC) /* {{{ */
549+
static bool phongo_parse_session(zval *options, mongoc_client_t *client, bson_t *mongoc_opts, zval **zsession TSRMLS_DC) /* {{{ */
548550
{
549551
zval *option = NULL;
550552
const mongoc_client_session_t *client_session;
@@ -652,7 +654,7 @@ bool phongo_execute_bulk_write(mongoc_client_t *client, const char *namespace, p
652654
return false;
653655
}
654656

655-
if (!phongo_parse_session(options, NULL, &zsession, client TSRMLS_CC)) {
657+
if (!phongo_parse_session(options, client, NULL, &zsession TSRMLS_CC)) {
656658
/* Exception should already have been thrown */
657659
return false;
658660
}
@@ -767,7 +769,7 @@ int phongo_execute_query(mongoc_client_t *client, const char *namespace, zval *z
767769
return false;
768770
}
769771

770-
if (!phongo_parse_session(options, query->opts, NULL, client TSRMLS_CC)) {
772+
if (!phongo_parse_session(options, client, query->opts, NULL TSRMLS_CC)) {
771773
/* Exception should already have been thrown */
772774
mongoc_collection_destroy(collection);
773775
return false;
@@ -839,7 +841,7 @@ int phongo_execute_command(mongoc_client_t *client, php_phongo_command_type_t ty
839841
return false;
840842
}
841843

842-
if (!phongo_parse_session(options, &opts, NULL, client TSRMLS_CC)) {
844+
if (!phongo_parse_session(options, client, &opts, NULL TSRMLS_CC)) {
843845
/* Exception should already have been thrown */
844846
bson_destroy(&opts);
845847
return false;

0 commit comments

Comments
 (0)