Skip to content

Commit 515a17f

Browse files
authored
Test php 7.0, 7.1, 7.2 (arnaud-lb#431)
1 parent 3fe62d0 commit 515a17f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ jobs:
3939
librdkafka: 'v0.11.6'
4040
- php: '7.3.0'
4141
librdkafka: 'v0.11.6'
42+
- php: '7.2.0'
43+
librdkafka: 'v0.11.6'
44+
- php: '7.1.0'
45+
librdkafka: 'v0.11.6'
46+
- php: '7.0.0'
47+
librdkafka: 'v0.11.6'
4248
- php: '8.0.0'
4349
librdkafka: 'master'
4450
experimental: true

php_rdkafka_priv.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,20 @@
5555

5656
#define rdkafka_get_debug_object(type, object) get_object(object)
5757

58+
#if PHP_MINOR_VERSION < 3
59+
/* Allocates object type and zeros it, but not the properties.
60+
* Properties MUST be initialized using object_properties_init(). */
61+
static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) {
62+
void *obj = emalloc(obj_size + zend_object_properties_size(ce));
63+
/* Subtraction of sizeof(zval) is necessary, because zend_object_properties_size() may be
64+
* -sizeof(zval), if the object has no properties. */
65+
memset(obj, 0, obj_size - sizeof(zval));
66+
return obj;
67+
}
5868
#endif
5969

70+
#endif // PHP 7
71+
6072
#define Z_RDKAFKA_P(php_kafka_type, zobject) php_kafka_from_obj(php_kafka_type, Z_OBJ_P(zobject))
6173

6274
#define php_kafka_from_obj(php_kafka_type, object) \

0 commit comments

Comments
 (0)