Skip to content

Commit e0db82c

Browse files
Fix for PHP 7.3 (#215)
Co-authored-by: Remi Collet <remi@remirepo.net>
1 parent 0073e39 commit e0db82c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

zmq.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ php_zmq_context *php_zmq_context_get(zend_long io_threads, zend_bool is_persiste
235235
le.type = php_zmq_context_list_entry();
236236
le.ptr = context;
237237

238+
#if PHP_VERSION_ID < 70300
239+
GC_REFCOUNT(&le) = 1;
240+
#else
238241
GC_SET_REFCOUNT(&le, 1);
242+
#endif
239243

240244
/* plist_key is not a persistent allocated key, thus we use str_update here */
241245
if (zend_hash_str_update_mem(&EG(persistent_list), plist_key->val, plist_key->len, &le, sizeof(le)) == NULL) {
@@ -535,7 +539,11 @@ void php_zmq_socket_store(php_zmq_socket *zmq_sock_p, zend_long type, zend_strin
535539
le.type = php_zmq_socket_list_entry();
536540
le.ptr = zmq_sock_p;
537541

542+
#if PHP_VERSION_ID < 70300
543+
GC_REFCOUNT(&le) = 1;
544+
#else
538545
GC_SET_REFCOUNT(&le, 1);
546+
#endif
539547

540548
plist_key = php_zmq_socket_plist_key(type, persistent_id, use_shared_ctx);
541549

0 commit comments

Comments
 (0)