From bf2e263195f9909b017fcf93d96cfc83a97ad2e3 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 23 May 2014 11:29:30 +0200 Subject: [PATCH] zts and 5.6 fixes --- src/php_pq_callback.h | 2 +- src/php_pq_misc.h | 7 +++++++ src/php_pqconn.c | 2 +- src/php_pqcur.c | 8 ++++---- src/php_pqtxn.c | 4 ++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/php_pq_callback.h b/src/php_pq_callback.h index a5d167a..3b0d48e 100644 --- a/src/php_pq_callback.h +++ b/src/php_pq_callback.h @@ -24,7 +24,7 @@ typedef struct php_pq_callback { void php_pq_callback_dtor(php_pq_callback_t *cb); void php_pq_callback_addref(php_pq_callback_t *cb); zval *php_pq_callback_to_zval(php_pq_callback_t *cb); -zend_bool php_pq_callback_is_locked(php_pq_callback_t *cb); +zend_bool php_pq_callback_is_locked(php_pq_callback_t *cb TSRMLS_DC); void php_pq_callback_recurse(php_pq_callback_t *old, php_pq_callback_t *new TSRMLS_DC); #endif diff --git a/src/php_pq_misc.h b/src/php_pq_misc.h index 0ba99a2..9198929 100644 --- a/src/php_pq_misc.h +++ b/src/php_pq_misc.h @@ -18,6 +18,13 @@ typedef int STATUS; /* SUCCESS/FAILURE */ +/* TSRM morony */ +#if PHP_VERSION_ID >= 50700 +# define z_is_true(z) zend_is_true(z TSRMLS_CC) +#else +# define z_is_true zend_is_true +#endif + /* trim LF from EOL */ char *rtrim(char *e); diff --git a/src/php_pqconn.c b/src/php_pqconn.c index 79fa9a0..a1492f0 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -238,7 +238,7 @@ static void php_pqconn_object_write_unbuffered(zval *object, void *o, zval *valu { php_pqconn_object_t *obj = o; - obj->intern->unbuffered = zend_is_true(value); + obj->intern->unbuffered = z_is_true(value); } static void php_pqconn_object_read_db(zval *object, void *o, zval *return_value TSRMLS_DC) diff --git a/src/php_pqcur.c b/src/php_pqcur.c index 1cb5d58..00ad2b8 100644 --- a/src/php_pqcur.c +++ b/src/php_pqcur.c @@ -82,7 +82,7 @@ static void cur_fetch_or_move(INTERNAL_FUNCTION_PARAMETERS, const char *action, } else if (obj->intern->conn->intern->unbuffered && !PQsetSingleRowMode(obj->intern->conn->intern->conn)) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to enable unbuffered mode (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { - php_pq_callback_recurse(&obj->intern->conn->intern->onevent, &resolver); + php_pq_callback_recurse(&obj->intern->conn->intern->onevent, &resolver TSRMLS_CC); obj->intern->conn->intern->poller = PQconsumeInput; } } else { @@ -176,9 +176,9 @@ static PHP_METHOD(pqcur, open) php_pqcur_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (!obj->intern) { - throw_exce(EX_UNINITIALIZED, "pq\\Cursor not initialized"); + throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Cursor not initialized"); } else if (!obj->intern->open) { - if (SUCCESS == php_pqconn_declare(NULL, obj->intern->conn, obj->intern->decl)) { + if (SUCCESS == php_pqconn_declare(NULL, obj->intern->conn, obj->intern->decl TSRMLS_CC)) { obj->intern->open = 1; } } @@ -200,7 +200,7 @@ static PHP_METHOD(pqcur, close) php_pqcur_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (!obj->intern) { - throw_exce(EX_UNINITIALIZED, "pq\\Cursor not initialized"); + throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Cursor not initialized"); } else { cur_close(obj TSRMLS_CC); } diff --git a/src/php_pqtxn.c b/src/php_pqtxn.c index 7d4b8b7..41b4950 100644 --- a/src/php_pqtxn.c +++ b/src/php_pqtxn.c @@ -175,7 +175,7 @@ static void php_pqtxn_object_write_readonly(zval *object, void *o, zval *value T php_pqtxn_object_t *obj = o; PGresult *res; - if ((obj->intern->readonly = zend_is_true(value))) { + if ((obj->intern->readonly = z_is_true(value))) { res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION READ ONLY"); } else { res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION READ WRITE"); @@ -192,7 +192,7 @@ static void php_pqtxn_object_write_deferrable(zval *object, void *o, zval *value php_pqtxn_object_t *obj = o; PGresult *res; - if ((obj->intern->deferrable = zend_is_true(value))) { + if ((obj->intern->deferrable = z_is_true(value))) { res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION DEFERRABLE"); } else { res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION NOT DEFERRABLE");