Skip to content

Commit 00e8f08

Browse files
committed
PHPC-1793: Use zend_ce_countable for PHP 8.1+ compat
zend_ce_countable was introduced in PHP 7.2 (see: php/php-src@27e7aea) and spl_ce_Countable was removed in PHP 8.1 (see: php/php-src@4f4c031).
1 parent ed31cba commit 00e8f08

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/MongoDB/BulkWrite.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <php.h>
1818
#include <Zend/zend_interfaces.h>
19-
#include <ext/spl/spl_iterators.h>
2019

2120
#ifdef HAVE_CONFIG_H
2221
#include "config.h"
@@ -27,6 +26,11 @@
2726
#include "php_phongo.h"
2827
#include "php_bson.h"
2928

29+
#if PHP_VERSION_ID < 70200
30+
#include <ext/spl/spl_iterators.h>
31+
#define zend_ce_countable spl_ce_Countable
32+
#endif /* PHP_VERSION_ID < 70200 */
33+
3034
#define PHONGO_BULKWRITE_BYPASS_UNSET -1
3135

3236
zend_class_entry* php_phongo_bulkwrite_ce;
@@ -669,7 +673,7 @@ void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS) /* {{{ */
669673
php_phongo_handler_bulkwrite.free_obj = php_phongo_bulkwrite_free_object;
670674
php_phongo_handler_bulkwrite.offset = XtOffsetOf(php_phongo_bulkwrite_t, std);
671675

672-
zend_class_implements(php_phongo_bulkwrite_ce, 1, spl_ce_Countable);
676+
zend_class_implements(php_phongo_bulkwrite_ce, 1, zend_ce_countable);
673677
} /* }}} */
674678

675679
/*

0 commit comments

Comments
 (0)