Skip to content

Commit b0b1fd1

Browse files
authored
PHPC-2146: Refactor typemap struct and BSON encoding/decoding of zvals (#1369)
* Avoid re-parsing bson when converting to zval A lot of occurrences start out with a bson_t*, then call bson_get_data on it to pass it to php_phongo_bson_to_zval_ex. This however creates a new bson reader and creates a new bson_t* from the given data. This is unnecessary and we should pass the original bson_t* in these instances. * Refactor typemap struct * Extract object initialisation from document visitor * Refactor document and array visitors * Fix wrong signature in array visitor declaration * Rename ce member for consistency * Add exception thrown comment * Fix clang-format
1 parent ae18d5c commit b0b1fd1

21 files changed

+308
-273
lines changed

src/BSON/Javascript.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ HashTable* php_phongo_javascript_get_properties_hash(phongo_compat_object_handle
9494
php_phongo_bson_state state;
9595

9696
PHONGO_BSON_INIT_STATE(state);
97-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
97+
if (!php_phongo_bson_to_zval_ex(intern->scope, &state)) {
9898
zval_ptr_dtor(&state.zchild);
9999
goto failure;
100100
}
@@ -194,7 +194,7 @@ static PHP_METHOD(MongoDB_BSON_Javascript, getScope)
194194

195195
PHONGO_BSON_INIT_STATE(state);
196196

197-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
197+
if (!php_phongo_bson_to_zval_ex(intern->scope, &state)) {
198198
zval_ptr_dtor(&state.zchild);
199199
return;
200200
}
@@ -220,7 +220,7 @@ static PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize)
220220
php_phongo_bson_state state;
221221

222222
PHONGO_BSON_INIT_STATE(state);
223-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
223+
if (!php_phongo_bson_to_zval_ex(intern->scope, &state)) {
224224
zval_ptr_dtor(&state.zchild);
225225
return;
226226
}
@@ -244,7 +244,7 @@ static PHP_METHOD(MongoDB_BSON_Javascript, serialize)
244244
PHONGO_PARSE_PARAMETERS_NONE();
245245

246246
if (intern->scope && intern->scope->len) {
247-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
247+
if (!php_phongo_bson_to_zval_ex(intern->scope, &state)) {
248248
zval_ptr_dtor(&state.zchild);
249249
return;
250250
}

src/BSON/functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PHP_FUNCTION(toPHP)
6565
return;
6666
}
6767

68-
if (!php_phongo_bson_to_zval_ex((const unsigned char*) data, data_len, &state)) {
68+
if (!php_phongo_bson_data_to_zval_ex((const unsigned char*) data, data_len, &state)) {
6969
zval_ptr_dtor(&state.zchild);
7070
php_phongo_bson_typemap_dtor(&state.map);
7171
RETURN_NULL();

src/MongoDB/BulkWrite.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ static void php_phongo_bulkwrite_extract_id(bson_t* doc, zval** return_value)
4040
php_phongo_bson_state state;
4141

4242
PHONGO_BSON_INIT_STATE(state);
43-
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
43+
state.map.root.type = PHONGO_TYPEMAP_NATIVE_ARRAY;
4444

45-
if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &state)) {
45+
if (!php_phongo_bson_to_zval_ex(doc, &state)) {
4646
goto cleanup;
4747
}
4848

@@ -632,7 +632,7 @@ static HashTable* php_phongo_bulkwrite_get_debug_info(phongo_compat_object_handl
632632
if (intern->let) {
633633
zval zv;
634634

635-
if (!php_phongo_bson_to_zval(bson_get_data(intern->let), intern->let->len, &zv)) {
635+
if (!php_phongo_bson_to_zval(intern->let, &zv)) {
636636
zval_ptr_dtor(&zv);
637637
goto done;
638638
}

src/MongoDB/ClientEncryption.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ static void phongo_clientencryption_create_datakey(php_phongo_clientencryption_t
4040
static void phongo_clientencryption_encrypt(php_phongo_clientencryption_t* clientencryption, zval* zvalue, zval* zciphertext, zval* options);
4141
static void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clientencryption, zval* zciphertext, zval* zvalue);
4242

43-
#define RETVAL_BSON_T(reply) \
44-
do { \
45-
php_phongo_bson_state state; \
46-
PHONGO_BSON_INIT_STATE(state); \
47-
if (!php_phongo_bson_to_zval_ex(bson_get_data(&(reply)), (reply).len, &state)) { \
48-
zval_ptr_dtor(&state.zchild); \
49-
goto cleanup; \
50-
} \
51-
RETVAL_ZVAL(&state.zchild, 0, 1); \
43+
#define RETVAL_BSON_T(reply) \
44+
do { \
45+
php_phongo_bson_state state; \
46+
PHONGO_BSON_INIT_STATE(state); \
47+
if (!php_phongo_bson_to_zval_ex(&(reply), &state)) { \
48+
zval_ptr_dtor(&state.zchild); \
49+
goto cleanup; \
50+
} \
51+
RETVAL_ZVAL(&state.zchild, 0, 1); \
5252
} while (0)
5353

5454
#define RETVAL_OPTIONAL_BSON_T(reply) \

src/MongoDB/Command.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static HashTable* php_phongo_command_get_debug_info(phongo_compat_object_handler
156156
if (intern->bson) {
157157
zval zv;
158158

159-
if (!php_phongo_bson_to_zval(bson_get_data(intern->bson), intern->bson->len, &zv)) {
159+
if (!php_phongo_bson_to_zval(intern->bson, &zv)) {
160160
zval_ptr_dtor(&zv);
161161
goto done;
162162
}

src/MongoDB/Cursor.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static PHP_METHOD(MongoDB_Driver_Cursor, setTypeMap)
9090
if (restore_current_element && mongoc_cursor_current(intern->cursor)) {
9191
const bson_t* doc = mongoc_cursor_current(intern->cursor);
9292

93-
if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data)) {
93+
if (!php_phongo_bson_to_zval_ex(doc, &intern->visitor_data)) {
9494
php_phongo_cursor_free_current(intern);
9595
}
9696
}
@@ -223,7 +223,7 @@ static PHP_METHOD(MongoDB_Driver_Cursor, next)
223223
}
224224

225225
if (mongoc_cursor_next(intern->cursor, &doc)) {
226-
if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data)) {
226+
if (!php_phongo_bson_to_zval_ex(doc, &intern->visitor_data)) {
227227
/* Free invalid result, but don't return as we want to free the
228228
* session if the intern is exhausted. */
229229
php_phongo_cursor_free_current(intern);
@@ -278,7 +278,7 @@ static PHP_METHOD(MongoDB_Driver_Cursor, rewind)
278278
doc = mongoc_cursor_current(intern->cursor);
279279

280280
if (doc) {
281-
if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data)) {
281+
if (!php_phongo_bson_to_zval_ex(doc, &intern->visitor_data)) {
282282
/* Free invalid result, but don't return as we want to free the
283283
* session if the intern is exhausted. */
284284
php_phongo_cursor_free_current(intern);

src/MongoDB/Monitoring/CommandFailedEvent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getReply)
9494

9595
PHONGO_PARSE_PARAMETERS_NONE();
9696

97-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
97+
if (!php_phongo_bson_to_zval_ex(intern->reply, &state)) {
9898
zval_ptr_dtor(&state.zchild);
9999
return;
100100
}
@@ -223,7 +223,7 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_obj
223223
sprintf(operation_id, "%" PRIu64, intern->operation_id);
224224
ADD_ASSOC_STRING(&retval, "operationId", operation_id);
225225

226-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
226+
if (!php_phongo_bson_to_zval_ex(intern->reply, &reply_state)) {
227227
zval_ptr_dtor(&reply_state.zchild);
228228
goto done;
229229
}

src/MongoDB/Monitoring/CommandStartedEvent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommand)
4444

4545
PHONGO_PARSE_PARAMETERS_NONE();
4646

47-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &state)) {
47+
if (!php_phongo_bson_to_zval_ex(intern->command, &state)) {
4848
zval_ptr_dtor(&state.zchild);
4949
return;
5050
}
@@ -202,7 +202,7 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_ob
202202
*is_temp = 1;
203203
array_init_size(&retval, 6);
204204

205-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &command_state)) {
205+
if (!php_phongo_bson_to_zval_ex(intern->command, &command_state)) {
206206
zval_ptr_dtor(&command_state.zchild);
207207
goto done;
208208
}

src/MongoDB/Monitoring/CommandSucceededEvent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getReply)
8282

8383
PHONGO_PARSE_PARAMETERS_NONE();
8484

85-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
85+
if (!php_phongo_bson_to_zval_ex(intern->reply, &state)) {
8686
zval_ptr_dtor(&state.zchild);
8787
return;
8888
}
@@ -204,7 +204,7 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_
204204
sprintf(operation_id, "%" PRIu64, intern->operation_id);
205205
ADD_ASSOC_STRING(&retval, "operationId", operation_id);
206206

207-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
207+
if (!php_phongo_bson_to_zval_ex(intern->reply, &reply_state)) {
208208
zval_ptr_dtor(&reply_state.zchild);
209209
goto done;
210210
}

src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, getRe
6666

6767
PHONGO_PARSE_PARAMETERS_NONE();
6868

69-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
69+
if (!php_phongo_bson_to_zval_ex(intern->reply, &state)) {
7070
zval_ptr_dtor(&state.zchild);
7171
return;
7272
}
@@ -126,7 +126,7 @@ static HashTable* php_phongo_serverheartbeatsucceededevent_get_debug_info(phongo
126126
ADD_ASSOC_LONG_EX(&retval, "port", intern->host.port);
127127
ADD_ASSOC_BOOL_EX(&retval, "awaited", intern->awaited);
128128

129-
if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
129+
if (!php_phongo_bson_to_zval_ex(intern->reply, &reply_state)) {
130130
zval_ptr_dtor(&reply_state.zchild);
131131
goto done;
132132
}

src/MongoDB/Query.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static HashTable* php_phongo_query_get_debug_info(phongo_compat_object_handler_t
471471
if (intern->filter) {
472472
zval zv;
473473

474-
if (!php_phongo_bson_to_zval(bson_get_data(intern->filter), intern->filter->len, &zv)) {
474+
if (!php_phongo_bson_to_zval(intern->filter, &zv)) {
475475
zval_ptr_dtor(&zv);
476476
goto done;
477477
}
@@ -484,7 +484,7 @@ static HashTable* php_phongo_query_get_debug_info(phongo_compat_object_handler_t
484484
if (intern->opts) {
485485
zval zv;
486486

487-
if (!php_phongo_bson_to_zval(bson_get_data(intern->opts), intern->opts->len, &zv)) {
487+
if (!php_phongo_bson_to_zval(intern->opts, &zv)) {
488488
zval_ptr_dtor(&zv);
489489
goto done;
490490
}

src/MongoDB/ReadPreference.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, getHedge)
341341

342342
PHONGO_BSON_INIT_STATE(state);
343343

344-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
344+
if (!php_phongo_bson_to_zval_ex(hedge, &state)) {
345345
zval_ptr_dtor(&state.zchild);
346346
return;
347347
}
@@ -412,7 +412,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, getTagSets)
412412

413413
PHONGO_BSON_INIT_DEBUG_STATE(state);
414414

415-
if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
415+
if (!php_phongo_bson_to_zval_ex(tags, &state)) {
416416
zval_ptr_dtor(&state.zchild);
417417
return;
418418
}
@@ -458,9 +458,9 @@ static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_ob
458458
/* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type since tags is an
459459
* array; however, inner documents and arrays can use the default. */
460460
PHONGO_BSON_INIT_STATE(state);
461-
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
461+
state.map.root.type = PHONGO_TYPEMAP_NATIVE_ARRAY;
462462

463-
if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
463+
if (!php_phongo_bson_to_zval_ex(tags, &state)) {
464464
zval_ptr_dtor(&state.zchild);
465465
goto done;
466466
}
@@ -483,7 +483,7 @@ static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_ob
483483

484484
PHONGO_BSON_INIT_STATE(state);
485485

486-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
486+
if (!php_phongo_bson_to_zval_ex(hedge, &state)) {
487487
zval_ptr_dtor(&state.zchild);
488488
goto done;
489489
}
@@ -540,7 +540,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, serialize)
540540

541541
PHONGO_BSON_INIT_DEBUG_STATE(state);
542542

543-
if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
543+
if (!php_phongo_bson_to_zval_ex(tags, &state)) {
544544
zval_ptr_dtor(&state.zchild);
545545
return;
546546
}
@@ -557,7 +557,7 @@ static PHP_METHOD(MongoDB_Driver_ReadPreference, serialize)
557557

558558
PHONGO_BSON_INIT_STATE(state);
559559

560-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
560+
if (!php_phongo_bson_to_zval_ex(hedge, &state)) {
561561
zval_ptr_dtor(&state.zchild);
562562
return;
563563
}

src/MongoDB/Server.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static PHP_METHOD(MongoDB_Driver_Server, getTags)
257257
PHONGO_BSON_INIT_DEBUG_STATE(state);
258258
bson_iter_document(&iter, &len, &bytes);
259259

260-
if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
260+
if (!php_phongo_bson_data_to_zval_ex(bytes, len, &state)) {
261261
/* Exception should already have been thrown */
262262
zval_ptr_dtor(&state.zchild);
263263
mongoc_server_description_destroy(sd);
@@ -316,7 +316,7 @@ static PHP_METHOD(MongoDB_Driver_Server, getInfo)
316316

317317
PHONGO_BSON_INIT_DEBUG_STATE(state);
318318

319-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hello_response), hello_response->len, &state)) {
319+
if (!php_phongo_bson_to_zval_ex(hello_response, &state)) {
320320
/* Exception should already have been thrown */
321321
zval_ptr_dtor(&state.zchild);
322322
goto cleanup;
@@ -640,7 +640,7 @@ bool php_phongo_server_to_zval(zval* retval, mongoc_client_t* client, mongoc_ser
640640

641641
PHONGO_BSON_INIT_DEBUG_STATE(state);
642642
bson_iter_document(&iter, &len, &bytes);
643-
if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
643+
if (!php_phongo_bson_data_to_zval_ex(bytes, len, &state)) {
644644
/* Exception already thrown */
645645
zval_ptr_dtor(&state.zchild);
646646
return false;
@@ -666,7 +666,7 @@ bool php_phongo_server_to_zval(zval* retval, mongoc_client_t* client, mongoc_ser
666666
PHONGO_BSON_INIT_DEBUG_STATE(state);
667667
handshake_response = mongoc_server_description_hello_response(handshake_sd);
668668

669-
if (!php_phongo_bson_to_zval_ex(bson_get_data(handshake_response), handshake_response->len, &state)) {
669+
if (!php_phongo_bson_to_zval_ex(handshake_response, &state)) {
670670
/* Exception already thrown */
671671
mongoc_server_description_destroy(handshake_sd);
672672
zval_ptr_dtor(&state.zchild);
@@ -680,7 +680,7 @@ bool php_phongo_server_to_zval(zval* retval, mongoc_client_t* client, mongoc_ser
680680

681681
PHONGO_BSON_INIT_DEBUG_STATE(state);
682682

683-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hello_response), hello_response->len, &state)) {
683+
if (!php_phongo_bson_to_zval_ex(hello_response, &state)) {
684684
/* Exception already thrown */
685685
zval_ptr_dtor(&state.zchild);
686686
return false;

src/MongoDB/ServerDescription.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static PHP_METHOD(MongoDB_Driver_ServerDescription, getHelloResponse)
6767

6868
PHONGO_BSON_INIT_DEBUG_STATE(state);
6969

70-
if (!php_phongo_bson_to_zval_ex(bson_get_data(helloResponse), helloResponse->len, &state)) {
70+
if (!php_phongo_bson_to_zval_ex(helloResponse, &state)) {
7171
/* Exception should already have been thrown */
7272
zval_ptr_dtor(&state.zchild);
7373
return;
@@ -214,7 +214,7 @@ HashTable* php_phongo_serverdescription_get_properties_hash(phongo_compat_object
214214

215215
PHONGO_BSON_INIT_DEBUG_STATE(state);
216216

217-
if (!php_phongo_bson_to_zval_ex(bson_get_data(hello_response), hello_response->len, &state)) {
217+
if (!php_phongo_bson_to_zval_ex(hello_response, &state)) {
218218
zval_ptr_dtor(&state.zchild);
219219
goto done;
220220
}

src/MongoDB/Session.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static PHP_METHOD(MongoDB_Driver_Session, getClusterTime)
226226
RETURN_NULL();
227227
}
228228

229-
if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
229+
if (!php_phongo_bson_to_zval_ex(cluster_time, &state)) {
230230
/* Exception should already have been thrown */
231231
zval_ptr_dtor(&state.zchild);
232232
return;
@@ -251,7 +251,7 @@ static PHP_METHOD(MongoDB_Driver_Session, getLogicalSessionId)
251251

252252
lsid = mongoc_client_session_get_lsid(intern->client_session);
253253

254-
if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
254+
if (!php_phongo_bson_to_zval_ex(lsid, &state)) {
255255
/* Exception should already have been thrown */
256256
zval_ptr_dtor(&state.zchild);
257257
return;
@@ -602,7 +602,7 @@ static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler
602602

603603
PHONGO_BSON_INIT_DEBUG_STATE(state);
604604

605-
if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
605+
if (!php_phongo_bson_to_zval_ex(lsid, &state)) {
606606
zval_ptr_dtor(&state.zchild);
607607
goto done;
608608
}
@@ -618,7 +618,7 @@ static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler
618618

619619
PHONGO_BSON_INIT_DEBUG_STATE(state);
620620

621-
if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
621+
if (!php_phongo_bson_to_zval_ex(cluster_time, &state)) {
622622
zval_ptr_dtor(&state.zchild);
623623
goto done;
624624
}

src/MongoDB/WriteConcernError.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ zend_bool phongo_writeconcernerror_init(zval* return_value, bson_t* bson)
158158

159159
bson_iter_document(&iter, &len, &data);
160160

161-
if (!php_phongo_bson_to_zval(data, len, &intern->info)) {
161+
if (!php_phongo_bson_data_to_zval(data, len, &intern->info)) {
162162
zval_ptr_dtor(&intern->info);
163163
ZVAL_UNDEF(&intern->info);
164164

src/MongoDB/WriteError.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ zend_bool phongo_writeerror_init(zval* return_value, bson_t* bson)
173173

174174
bson_iter_document(&iter, &len, &data);
175175

176-
if (!php_phongo_bson_to_zval(data, len, &intern->info)) {
176+
if (!php_phongo_bson_data_to_zval(data, len, &intern->info)) {
177177
zval_ptr_dtor(&intern->info);
178178
ZVAL_UNDEF(&intern->info);
179179

0 commit comments

Comments
 (0)