Skip to content

Commit adbe8bb

Browse files
committed
PHPC-427: Fix parsing of null WC journal param for PHP 5.4
1 parent dcbf5ae commit adbe8bb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/MongoDB/WriteConcern.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,16 @@ PHP_METHOD(WriteConcern, __construct)
5353
{
5454
php_phongo_writeconcern_t *intern;
5555
zend_error_handling error_handling;
56-
zval *w;
56+
zval *w, *journal;
5757
long wtimeout = 0;
58-
zend_bool journal = 0;
59-
zend_bool journal_is_null = 0;
6058

6159
(void)return_value; (void)return_value_ptr; (void)return_value_used;
6260

6361

6462
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
6563
intern = (php_phongo_writeconcern_t *)zend_object_store_get_object(getThis() TSRMLS_CC);
6664

67-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lb!", &w, &wtimeout, &journal, &journal_is_null) == FAILURE) {
65+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|lz", &w, &wtimeout, &journal) == FAILURE) {
6866
zend_restore_error_handling(&error_handling TSRMLS_CC);
6967
return;
7068
}
@@ -92,8 +90,8 @@ PHP_METHOD(WriteConcern, __construct)
9290

9391
switch(ZEND_NUM_ARGS()) {
9492
case 3:
95-
if (!journal_is_null) {
96-
mongoc_write_concern_set_journal(intern->write_concern, journal);
93+
if (Z_TYPE_P(journal) != IS_NULL) {
94+
mongoc_write_concern_set_journal(intern->write_concern, Z_BVAL_P(journal));
9795
}
9896
/* fallthrough */
9997
case 2:

0 commit comments

Comments
 (0)