@@ -298,7 +298,7 @@ static PHP_METHOD(WriteConcern, isDefault)
298
298
RETURN_BOOL (mongoc_write_concern_is_default (intern -> write_concern ));
299
299
} /* }}} */
300
300
301
- static HashTable * php_phongo_writeconcern_get_properties_hash (phongo_compat_object_handler_type * object , bool is_temp , bool is_bson ) /* {{{ */
301
+ static HashTable * php_phongo_writeconcern_get_properties_hash (phongo_compat_object_handler_type * object , bool is_temp , bool is_bson , bool is_serialize ) /* {{{ */
302
302
{
303
303
php_phongo_writeconcern_t * intern ;
304
304
HashTable * props ;
@@ -344,6 +344,12 @@ static HashTable* php_phongo_writeconcern_get_properties_hash(phongo_compat_obje
344
344
345
345
if (is_bson ) {
346
346
ZVAL_INT64 (& z_wtimeout , wtimeout );
347
+ } else if (is_serialize ) {
348
+ if (wtimeout > INT32_MAX || wtimeout < INT32_MIN ) {
349
+ ZVAL_INT64_STRING (& z_wtimeout , wtimeout );
350
+ } else {
351
+ ZVAL_LONG (& z_wtimeout , wtimeout );
352
+ }
347
353
} else {
348
354
#if SIZEOF_ZEND_LONG == 4
349
355
if (wtimeout > INT32_MAX || wtimeout < INT32_MIN ) {
@@ -376,7 +382,7 @@ static PHP_METHOD(WriteConcern, bsonSerialize)
376
382
}
377
383
zend_restore_error_handling (& error_handling );
378
384
379
- ZVAL_ARR (return_value , php_phongo_writeconcern_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true, true));
385
+ ZVAL_ARR (return_value , php_phongo_writeconcern_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true, true, false ));
380
386
convert_to_object (return_value );
381
387
} /* }}} */
382
388
@@ -487,7 +493,7 @@ static PHP_METHOD(WriteConcern, __serialize)
487
493
{
488
494
PHONGO_PARSE_PARAMETERS_NONE ();
489
495
490
- RETURN_ARR (php_phongo_writeconcern_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true, false));
496
+ RETURN_ARR (php_phongo_writeconcern_get_properties_hash (PHONGO_COMPAT_OBJ_P (getThis ()), true, false, true ));
491
497
} /* }}} */
492
498
493
499
/* {{{ proto array MongoDB\Driver\WriteConcern::__unserialize()
@@ -579,12 +585,12 @@ static zend_object* php_phongo_writeconcern_create_object(zend_class_entry* clas
579
585
static HashTable * php_phongo_writeconcern_get_debug_info (phongo_compat_object_handler_type * object , int * is_temp ) /* {{{ */
580
586
{
581
587
* is_temp = 1 ;
582
- return php_phongo_writeconcern_get_properties_hash (object , true, false);
588
+ return php_phongo_writeconcern_get_properties_hash (object , true, false, false );
583
589
} /* }}} */
584
590
585
591
static HashTable * php_phongo_writeconcern_get_properties (phongo_compat_object_handler_type * object ) /* {{{ */
586
592
{
587
- return php_phongo_writeconcern_get_properties_hash (object , false, false);
593
+ return php_phongo_writeconcern_get_properties_hash (object , false, false, false );
588
594
} /* }}} */
589
595
590
596
void php_phongo_writeconcern_init_ce (INIT_FUNC_ARGS ) /* {{{ */
0 commit comments