Skip to content

Commit 0cee163

Browse files
committed
PHPC-1472: Return status of php_phongo_server_to_zval
1 parent fef008e commit 0cee163

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

php_phongo.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ php_phongo_server_description_type_t php_phongo_server_description_type(mongoc_s
11631163
return PHONGO_SERVER_UNKNOWN;
11641164
}
11651165

1166-
void php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd) /* {{{ */
1166+
bool php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd) /* {{{ */
11671167
{
11681168
mongoc_host_list_t* host = mongoc_server_description_host(sd);
11691169
const bson_t* is_master = mongoc_server_description_ismaster(sd);
@@ -1189,7 +1189,7 @@ void php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd) /*
11891189
bson_iter_document(&iter, &len, &bytes);
11901190
if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
11911191
zval_ptr_dtor(&state.zchild);
1192-
return;
1192+
return false;
11931193
}
11941194

11951195
#if PHP_VERSION_ID >= 70000
@@ -1206,7 +1206,7 @@ void php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd) /*
12061206

12071207
if (!php_phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state)) {
12081208
zval_ptr_dtor(&state.zchild);
1209-
return;
1209+
return false;
12101210
}
12111211

12121212
#if PHP_VERSION_ID >= 70000
@@ -1217,6 +1217,7 @@ void php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd) /*
12171217
}
12181218
ADD_ASSOC_LONG_EX(retval, "round_trip_time", (phongo_long) mongoc_server_description_round_trip_time(sd));
12191219

1220+
return true;
12201221
} /* }}} */
12211222

12221223
void php_phongo_read_concern_to_zval(zval* retval, const mongoc_read_concern_t* read_concern) /* {{{ */

php_phongo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void php_phongo_prep_legacy_option_free(zval* options TSRMLS_DC);
155155
void php_phongo_read_preference_prep_tagsets(zval* tagSets TSRMLS_DC);
156156
bool php_phongo_read_preference_tags_are_valid(const bson_t* tags);
157157

158-
void php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd);
158+
bool php_phongo_server_to_zval(zval* retval, mongoc_server_description_t* sd);
159159
void php_phongo_read_concern_to_zval(zval* retval, const mongoc_read_concern_t* read_concern);
160160
void php_phongo_write_concern_to_zval(zval* retval, const mongoc_write_concern_t* write_concern);
161161
void php_phongo_cursor_to_zval(zval* retval, const mongoc_cursor_t* cursor);

0 commit comments

Comments
 (0)