Skip to content

PHPC-529: Prefix BSON functions to avoid symbol conflicts #194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions php_bson.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ typedef struct {
#define PHONGO_BSON_STATE_INITIALIZER { NULL, { PHONGO_TYPEMAP_NONE, NULL, PHONGO_TYPEMAP_NONE, NULL, PHONGO_TYPEMAP_NONE, NULL}, NULL}
#endif

PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *bson, bson_t **bson_out TSRMLS_DC);
PHONGO_API int bson_to_zval_ex(const unsigned char *data, int data_len, php_phongo_bson_state *state);
PHONGO_API void phongo_zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *bson, bson_t **bson_out TSRMLS_DC);
PHONGO_API int phongo_bson_to_zval_ex(const unsigned char *data, int data_len, php_phongo_bson_state *state);
#if PHP_VERSION_ID >= 70000
PHONGO_API int bson_to_zval(const unsigned char *data, int data_len, zval *out);
PHONGO_API int phongo_bson_to_zval(const unsigned char *data, int data_len, zval *out);
#else
PHONGO_API int bson_to_zval(const unsigned char *data, int data_len, zval **out);
PHONGO_API int phongo_bson_to_zval(const unsigned char *data, int data_len, zval **out);
#endif
PHONGO_API void php_phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC);
PHONGO_API void phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC);

PHP_FUNCTION(toPHP);
PHP_FUNCTION(fromPHP);
Expand Down
20 changes: 10 additions & 10 deletions php_phongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ zend_bool phongo_writeconcernerror_init(zval *return_value, bson_t *bson TSRMLS_
return false;
}

if (!bson_to_zval(data, len, &writeconcernerror->info)) {
if (!phongo_bson_to_zval(data, len, &writeconcernerror->info)) {
zval_ptr_dtor(&writeconcernerror->info);
#if PHP_VERSION_ID >= 70000
ZVAL_UNDEF(&writeconcernerror->info);
Expand Down Expand Up @@ -448,7 +448,7 @@ zend_bool phongo_writeerror_init(zval *return_value, bson_t *bson TSRMLS_DC) /*
bson_init(&info);
bson_append_iter(&info, NULL, 0, &iter);

if (!bson_to_zval(bson_get_data(&info), info.len, &writeerror->info)) {
if (!phongo_bson_to_zval(bson_get_data(&info), info.len, &writeerror->info)) {
zval_ptr_dtor(&writeerror->info);
#if PHP_VERSION_ID >= 70000
ZVAL_UNDEF(&writeerror->info);
Expand Down Expand Up @@ -1326,7 +1326,7 @@ void php_phongo_server_to_zval(zval *retval, const mongoc_server_description_t *
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&sd->tags), sd->tags.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&sd->tags), sd->tags.len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
#else
Expand All @@ -1339,7 +1339,7 @@ void php_phongo_server_to_zval(zval *retval, const mongoc_server_description_t *
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&sd->last_is_master), sd->last_is_master.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&sd->last_is_master), sd->last_is_master.len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "last_is_master", &state.zchild);
#else
Expand Down Expand Up @@ -1375,7 +1375,7 @@ void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&read_prefs->tags), read_prefs->tags.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&read_prefs->tags), read_prefs->tags.len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
#else
Expand Down Expand Up @@ -1439,7 +1439,7 @@ void php_phongo_cursor_to_zval(zval *retval, const mongoc_cursor_t *cursor) /* {
zval *zv;
#endif

bson_to_zval(bson_get_data(&cursor->query), cursor->query.len, &zv);
phongo_bson_to_zval(bson_get_data(&cursor->query), cursor->query.len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "query", &zv);
#else
Expand All @@ -1453,7 +1453,7 @@ void php_phongo_cursor_to_zval(zval *retval, const mongoc_cursor_t *cursor) /* {
zval *zv;
#endif

bson_to_zval(bson_get_data(&cursor->fields), cursor->fields.len, &zv);
phongo_bson_to_zval(bson_get_data(&cursor->fields), cursor->fields.len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "fields", &zv);
#else
Expand Down Expand Up @@ -1491,7 +1491,7 @@ void php_phongo_cursor_to_zval(zval *retval, const mongoc_cursor_t *cursor) /* {
zval *zv;
#endif

bson_to_zval(bson_get_data(cursor->current), cursor->current->len, &zv);
phongo_bson_to_zval(bson_get_data(cursor->current), cursor->current->len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "current_doc", &zv);
#else
Expand Down Expand Up @@ -2146,7 +2146,7 @@ static void php_phongo_cursor_iterator_move_forward(zend_object_iterator *iter T
cursor_it->current++;

if (mongoc_cursor_next(cursor->cursor, &doc)) {
bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
} else {
bson_error_t error;

Expand Down Expand Up @@ -2174,7 +2174,7 @@ static void php_phongo_cursor_iterator_rewind(zend_object_iterator *iter TSRMLS_
doc = mongoc_cursor_current(cursor->cursor);

if (doc) {
bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
}
} /* }}} */

Expand Down
4 changes: 2 additions & 2 deletions src/BSON/Javascript.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PHP_METHOD(Javascript, __construct)
zend_restore_error_handling(&error_handling TSRMLS_CC);

if (document) {
zval_to_bson(document, PHONGO_BSON_NONE, &scope, NULL TSRMLS_CC);
phongo_zval_to_bson(document, PHONGO_BSON_NONE, &scope, NULL TSRMLS_CC);
}

php_phongo_new_javascript_from_javascript_and_scope(0, getThis(), javascript, javascript_len, &scope TSRMLS_CC);
Expand Down Expand Up @@ -158,7 +158,7 @@ HashTable *php_phongo_javascript_get_debug_info(zval *object, int *is_temp TSRML
if (intern->document) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;

if (bson_to_zval_ex(bson_get_data(intern->document), intern->document->len, &state)) {
if (phongo_bson_to_zval_ex(bson_get_data(intern->document), intern->document->len, &state)) {
#if PHP_VERSION_ID >= 70000
Z_ADDREF(state.zchild);
ADD_ASSOC_ZVAL_EX(&retval, "scope", &state.zchild);
Expand Down
8 changes: 4 additions & 4 deletions src/MongoDB/BulkWrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ PHP_METHOD(BulkWrite, insert)
bson_flags |= PHONGO_BSON_ADD_ODS|PHONGO_BSON_ADD_CHILD_ODS;

bson = bson_new();
zval_to_bson(document, bson_flags, bson, &bson_out TSRMLS_CC);
phongo_zval_to_bson(document, bson_flags, bson, &bson_out TSRMLS_CC);
mongoc_bulk_operation_insert(intern->bulk, bson);
bson_clear(&bson);

Expand Down Expand Up @@ -149,8 +149,8 @@ PHP_METHOD(BulkWrite, update)
bquery = bson_new();
bupdate = bson_new();

zval_to_bson(query, PHONGO_BSON_NONE, bquery, NULL TSRMLS_CC);
zval_to_bson(newObj, PHONGO_BSON_NONE, bupdate, NULL TSRMLS_CC);
phongo_zval_to_bson(query, PHONGO_BSON_NONE, bquery, NULL TSRMLS_CC);
phongo_zval_to_bson(newObj, PHONGO_BSON_NONE, bupdate, NULL TSRMLS_CC);

if (updateOptions) {
flags |= php_array_fetch_bool(updateOptions, "multi") ? MONGOC_UPDATE_MULTI_UPDATE : 0;
Expand Down Expand Up @@ -201,7 +201,7 @@ PHP_METHOD(BulkWrite, delete)


bson = bson_new();
zval_to_bson(query, PHONGO_BSON_NONE, bson, NULL TSRMLS_CC);
phongo_zval_to_bson(query, PHONGO_BSON_NONE, bson, NULL TSRMLS_CC);

if (deleteOptions && php_array_fetch_bool(deleteOptions, "limit")) {
mongoc_bulk_operation_remove_one(intern->bulk, bson);
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB/Command.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ PHP_METHOD(Command, __construct)
zend_restore_error_handling(&error_handling TSRMLS_CC);


zval_to_bson(document, PHONGO_BSON_NONE, bson, NULL TSRMLS_CC);
phongo_zval_to_bson(document, PHONGO_BSON_NONE, bson, NULL TSRMLS_CC);
intern->bson = bson;
}
/* }}} */
Expand Down Expand Up @@ -153,7 +153,7 @@ HashTable *php_phongo_command_get_debug_info(zval *object, int *is_temp TSRMLS_D
zval *zv;
#endif

bson_to_zval(bson_get_data(intern->bson), intern->bson->len, &zv);
phongo_bson_to_zval(bson_get_data(intern->bson), intern->bson->len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "command", &zv);
#else
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ PHP_METHOD(Cursor, setTypeMap)
return;
}

php_phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);
phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);

intern->visitor_data = state;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PHP_METHOD(Manager, __construct)
zend_restore_error_handling(&error_handling TSRMLS_CC);

if (options) {
zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
}

phongo_manager_init(intern, uri_string, &bson_options, driverOptions TSRMLS_CC);
Expand Down
8 changes: 4 additions & 4 deletions src/MongoDB/Query.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PHP_METHOD(Query, __construct)
intern->query = bson_new();

bson_init(&bfilter);
zval_to_bson(zfilter, PHONGO_BSON_NONE, &bfilter, NULL TSRMLS_CC);
phongo_zval_to_bson(zfilter, PHONGO_BSON_NONE, &bfilter, NULL TSRMLS_CC);

if (zoptions) {
if (php_array_exists(zoptions, "readConcern")) {
Expand All @@ -96,7 +96,7 @@ PHP_METHOD(Query, __construct)
php_array_unsetc(zoptions, "readConcern");
}

zval_to_bson(zoptions, PHONGO_BSON_NONE, &boptions, NULL TSRMLS_CC);
phongo_zval_to_bson(zoptions, PHONGO_BSON_NONE, &boptions, NULL TSRMLS_CC);
}

if (!phongo_query_init(intern, &bfilter, &boptions TSRMLS_CC)) {
Expand Down Expand Up @@ -196,7 +196,7 @@ HashTable *php_phongo_query_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
zval *zv;
#endif

bson_to_zval(bson_get_data(intern->query), intern->query->len, &zv);
phongo_bson_to_zval(bson_get_data(intern->query), intern->query->len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "query", &zv);
#else
Expand All @@ -213,7 +213,7 @@ HashTable *php_phongo_query_get_debug_info(zval *object, int *is_temp TSRMLS_DC)
zval *zv;
#endif

bson_to_zval(bson_get_data(intern->selector), intern->selector->len, &zv);
phongo_bson_to_zval(bson_get_data(intern->selector), intern->selector->len, &zv);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "selector", &zv);
#else
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB/ReadPreference.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PHP_METHOD(ReadPreference, __construct)
if (tagSets) {
bson_t *tags = bson_new();

zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t *)tags, NULL TSRMLS_CC);
phongo_zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t *)tags, NULL TSRMLS_CC);
mongoc_read_prefs_set_tags(intern->read_preference, tags);
bson_destroy(tags);
if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
Expand Down Expand Up @@ -131,7 +131,7 @@ PHP_METHOD(ReadPreference, getTagSets)
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&intern->read_preference->tags), intern->read_preference->tags.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&intern->read_preference->tags), intern->read_preference->tags.len, &state);
#if PHP_VERSION_ID >= 70000
RETURN_ZVAL(&state.zchild, 0, 1);
#else
Expand Down
4 changes: 2 additions & 2 deletions src/MongoDB/Server.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ PHP_METHOD(Server, getTags)
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&sd->tags), sd->tags.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&sd->tags), sd->tags.len, &state);
#if PHP_VERSION_ID >= 70000
RETURN_ZVAL(&state.zchild, 0, 1);
#else
Expand Down Expand Up @@ -208,7 +208,7 @@ PHP_METHOD(Server, getInfo)
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&sd->last_is_master), sd->last_is_master.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&sd->last_is_master), sd->last_is_master.len, &state);

#if PHP_VERSION_ID >= 70000
RETURN_ZVAL(&state.zchild, 0, 1);
Expand Down
6 changes: 3 additions & 3 deletions src/MongoDB/WriteResult.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,14 @@ HashTable *php_phongo_writeresult_get_debug_info(zval *object, int *is_temp TSRM
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;

bson_to_zval_ex(bson_get_data(&intern->write_result.upserted), intern->write_result.upserted.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&intern->write_result.upserted), intern->write_result.upserted.len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", &state.zchild);
#else
ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", state.zchild);
#endif

bson_to_zval_ex(bson_get_data(&intern->write_result.writeErrors), intern->write_result.writeErrors.len, &state);
phongo_bson_to_zval_ex(bson_get_data(&intern->write_result.writeErrors), intern->write_result.writeErrors.len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "writeErrors", &state.zchild);
#else
Expand All @@ -510,7 +510,7 @@ HashTable *php_phongo_writeresult_get_debug_info(zval *object, int *is_temp TSRM

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

bson_to_zval_ex(data, len, &state);
phongo_bson_to_zval_ex(data, len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "writeConcernError", &state.zchild);
#else
Expand Down
31 changes: 16 additions & 15 deletions src/bson.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,17 +886,17 @@ void object_to_bson(zval *object, php_phongo_bson_flags_t flags, const char *key
}
}
#if PHP_VERSION_ID >= 70000
zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
#else
zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
#endif
bson_append_document_end(bson, &child);
} else {
bson_append_array_begin(bson, key, key_len, &child);
#if PHP_VERSION_ID >= 70000
zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
#else
zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
#endif
bson_append_array_end(bson, &child);
}
Expand Down Expand Up @@ -978,7 +978,7 @@ void object_to_bson(zval *object, php_phongo_bson_flags_t flags, const char *key

mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding document");
bson_append_document_begin(bson, key, key_len, &child);
zval_to_bson(object, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(object, flags, &child, NULL TSRMLS_CC);
bson_append_document_end(bson, &child);
}

Expand Down Expand Up @@ -1032,7 +1032,7 @@ static void phongo_bson_append(bson_t *bson, php_phongo_bson_flags_t flags, cons
}

bson_append_array_begin(bson, key, key_len, &child);
zval_to_bson(entry, flags, &child, NULL TSRMLS_CC);
phongo_zval_to_bson(entry, flags, &child, NULL TSRMLS_CC);
bson_append_array_end(bson, &child);

if (tmp_ht) {
Expand Down Expand Up @@ -1098,7 +1098,7 @@ static bool is_public_property(zend_class_entry *ce, const char *prop_name, int
}
/* }}} */

PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *bson, bson_t **bson_out TSRMLS_DC) /* {{{ */
PHONGO_API void phongo_zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *bson, bson_t **bson_out TSRMLS_DC) /* {{{ */
{
HashTable *ht_data = NULL;
#if PHP_VERSION_ID >= 70000
Expand Down Expand Up @@ -1334,15 +1334,15 @@ PHONGO_API void zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *

/* }}} */
#if PHP_VERSION_ID >= 70000
int bson_to_zval(const unsigned char *data, int data_len, zval *zv)
PHONGO_API int phongo_bson_to_zval(const unsigned char *data, int data_len, zval *zv)
#else
int bson_to_zval(const unsigned char *data, int data_len, zval **zv)
PHONGO_API int phongo_bson_to_zval(const unsigned char *data, int data_len, zval **zv)
#endif
{
int retval = 0;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;

retval = bson_to_zval_ex(data, data_len, &state);
retval = phongo_bson_to_zval_ex(data, data_len, &state);
#if PHP_VERSION_ID >= 70000
ZVAL_ZVAL(zv, &state.zchild, 1, 1);
#else
Expand All @@ -1351,7 +1351,8 @@ int bson_to_zval(const unsigned char *data, int data_len, zval **zv)

return retval;
}
int bson_to_zval_ex(const unsigned char *data, int data_len, php_phongo_bson_state *state)

PHONGO_API int phongo_bson_to_zval_ex(const unsigned char *data, int data_len, php_phongo_bson_state *state)
{
bson_reader_t *reader;
bson_iter_t iter;
Expand Down Expand Up @@ -1458,7 +1459,7 @@ PHP_FUNCTION(fromPHP)
}

bson = bson_new();
zval_to_bson(data, PHONGO_BSON_ADD_ODS|PHONGO_BSON_ADD_CHILD_ODS, bson, NULL TSRMLS_CC);
phongo_zval_to_bson(data, PHONGO_BSON_ADD_ODS|PHONGO_BSON_ADD_CHILD_ODS, bson, NULL TSRMLS_CC);

PHONGO_RETVAL_STRINGL((const char *) bson_get_data(bson), bson->len);
bson_destroy(bson);
Expand Down Expand Up @@ -1495,7 +1496,7 @@ static void apply_classname_to_state(const char *classname, int classname_len, p
}
}

void php_phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC)
PHONGO_API void phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC)
{
if (typemap) {
char *classname;
Expand Down Expand Up @@ -1543,9 +1544,9 @@ PHP_FUNCTION(toPHP)
return;
}

php_phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);
phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);

if (!bson_to_zval_ex((const unsigned char *)data, data_len, &state)) {
if (!phongo_bson_to_zval_ex((const unsigned char *)data, data_len, &state)) {
zval_ptr_dtor(&state.zchild);
RETURN_NULL();
}
Expand Down