Skip to content

Commit 22ca996

Browse files
committed
Fix setting debug logging as part of the driverOptions
1 parent a31e602 commit 22ca996

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

php_phongo.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
#undef MONGOC_LOG_DOMAIN
6060
#define MONGOC_LOG_DOMAIN "PHONGO"
6161

62+
#define PHONGO_DEBUG_INI "mongodb.debug_log"
63+
#define PHONGO_DEBUG_INI_DEFAULT ""
64+
6265
ZEND_DECLARE_MODULE_GLOBALS(mongodb)
6366

6467
/* {{{ phongo_std_object_handlers */
@@ -1237,7 +1240,7 @@ mongoc_client_t *php_phongo_make_mongo_client(const char *uri, zval *driverOptio
12371240
if (zend_hash_find(Z_ARRVAL_P(driverOptions), "debug", strlen("debug") + 1, (void**)&tmp) == SUCCESS) {
12381241
convert_to_string(*tmp);
12391242

1240-
zend_alter_ini_entry_ex((char *)"phongo.debug_log", sizeof("phongo.debug_log") , Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
1243+
zend_alter_ini_entry_ex((char *)PHONGO_DEBUG_INI, sizeof(PHONGO_DEBUG_INI), Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC);
12411244
}
12421245
}
12431246

@@ -1624,7 +1627,7 @@ void _phongo_debug_bson(bson_t *bson)
16241627

16251628
/* {{{ INI entries */
16261629
PHP_INI_BEGIN()
1627-
STD_PHP_INI_ENTRY("mongodb.debug_log", "", PHP_INI_ALL, OnUpdateString, debug_log, zend_mongodb_globals, mongodb_globals)
1630+
STD_PHP_INI_ENTRY(PHONGO_DEBUG_INI, PHONGO_DEBUG_INI_DEFAULT, PHP_INI_ALL, OnUpdateString, debug_log, zend_mongodb_globals, mongodb_globals)
16281631
PHP_INI_END()
16291632
/* }}} */
16301633

0 commit comments

Comments
 (0)