From d9c619e8edb9da67dcac23a9fcb82595a3a0e469 Mon Sep 17 00:00:00 2001
From: tombokombo <tombo@sysart.tech>
Date: Thu, 11 Mar 2021 13:00:34 +0100
Subject: [PATCH] Print warning in case of not closed connection

---
 zmq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/zmq.c b/zmq.c
index bd2401d..9ccf146 100644
--- a/zmq.c
+++ b/zmq.c
@@ -142,6 +142,9 @@ static int php_zmq_context_list_entry(void)
 static void php_zmq_context_destroy(php_zmq_context *context)
 {
 	if (context->pid == getpid()) {
+		if (php_zmq_context_socket_count_get(context) > 0) {
+			php_error_docref(NULL, E_WARNING, "php_zmq_context_socket_count_get() > 0, will cause infinite hang on zmq_term, unset all zmqsocket references manually eg. via shutdown func");
+		}
 		(void) zmq_term(context->z_ctx);
 	}
 	pefree(context, context->is_persistent);