+ zval rv;
+
+ ZVAL_NULL(&rv);
+ zend_fcall_info_args(&cb->fci, args);
+ zend_fcall_info_call(&cb->fci, &cb->fcc, &rv, NULL);
+ zend_fcall_info_args_clear(&cb->fci, 0);
+ zval_ptr_dtor(&rv);
+
+ return ZEND_HASH_APPLY_KEEP;
+}
+
+
+static inline PGresult *relisten(PGconn *conn, const char *channel_str, size_t channel_len)
+{
+ char *quoted_channel = PQescapeIdentifier(conn, channel_str, channel_len);
+ PGresult *res = NULL;
+
+ if (quoted_channel) {
+ smart_str cmd = {0};
+
+ smart_str_appends(&cmd, "LISTEN ");
+ smart_str_appends(&cmd, quoted_channel);
+ smart_str_0(&cmd);
+
+ res = PQexec(conn, smart_str_v(&cmd));
+
+ smart_str_free(&cmd);
+ PQfreemem(quoted_channel);
+ }
+
+ return res;
+}
+
+static int apply_relisten(zval *p, int argc, va_list argv, zend_hash_key *key)
+{
+ php_pqconn_object_t *obj = va_arg(argv, php_pqconn_object_t *);
+ PGresult *res = relisten(obj->intern->conn, key->key->val, key->key->len);