Skip to content

Commit c8f6bad

Browse files
committed
Create PHP 5.x compatibility macro for ZVAL_UNDEF
1 parent 04b4bf0 commit c8f6bad

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

phongo_compat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@
130130
# define ADD_NEXT_INDEX_STRINGL(_zv, _value, _len) add_next_index_stringl(_zv, _value, _len, 1);
131131
# define Z_PHPDATE_P(object) ((php_date_obj*)zend_object_store_get_object(object TSRMLS_CC))
132132
# define Z_ISUNDEF(x) !x
133+
# define ZVAL_UNDEF(x) do { (*x) = NULL; } while (0)
133134
# define phongo_free_object_arg void
134135
# define phongo_zpp_char_len int
135136
# define ZEND_HASH_APPLY_PROTECTION(ht) true

php_phongo.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,7 @@ zend_bool phongo_writeconcernerror_init(zval *return_value, bson_t *bson TSRMLS_
385385

386386
if (!phongo_bson_to_zval(data, len, &intern->info)) {
387387
zval_ptr_dtor(&intern->info);
388-
#if PHP_VERSION_ID >= 70000
389388
ZVAL_UNDEF(&intern->info);
390-
#else
391-
intern->info = NULL;
392-
#endif
393389

394390
return false;
395391
}
@@ -426,11 +422,7 @@ zend_bool phongo_writeerror_init(zval *return_value, bson_t *bson TSRMLS_DC) /*
426422

427423
if (!phongo_bson_to_zval(data, len, &intern->info)) {
428424
zval_ptr_dtor(&intern->info);
429-
#if PHP_VERSION_ID >= 70000
430425
ZVAL_UNDEF(&intern->info);
431-
#else
432-
intern->info = NULL;
433-
#endif
434426

435427
return false;
436428
}

src/MongoDB/Cursor.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ static void php_phongo_cursor_free_current(php_phongo_cursor_t *cursor) /* {{{ *
4444
{
4545
if (!Z_ISUNDEF(cursor->visitor_data.zchild)) {
4646
zval_ptr_dtor(&cursor->visitor_data.zchild);
47-
#if PHP_VERSION_ID >= 70000
4847
ZVAL_UNDEF(&cursor->visitor_data.zchild);
49-
#else
50-
cursor->visitor_data.zchild = NULL;
51-
#endif
5248
}
5349
} /* }}} */
5450

0 commit comments

Comments
 (0)