From 6da3520587f9f79c7429501289512d2a2415b517 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 4 Feb 2008 15:48:32 +0000 Subject: [PATCH] fix PHP_5_3 build --- http_message_object.c | 8 +++++++- http_querystring_object.c | 9 ++++++++- missing.h | 4 ++++ package2.xml | 19 +++---------------- php_http.h | 2 +- php_http_api.h | 5 +++++ 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/http_message_object.c b/http_message_object.c index b6d8de2..3853231 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -119,6 +119,7 @@ HTTP_END_ARGS; HTTP_EMPTY_ARGS(getParentMessage); HTTP_EMPTY_ARGS(send); +HTTP_EMPTY_ARGS(__toString); HTTP_BEGIN_ARGS(toString, 0) HTTP_ARG_VAL(include_parent, 0) HTTP_END_ARGS; @@ -195,7 +196,7 @@ zend_function_entry http_message_object_fe[] = { HTTP_MESSAGE_ME(key, ZEND_ACC_PUBLIC) HTTP_MESSAGE_ME(next, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpMessage, __toString, toString, HTTP_ARGS(HttpMessage, toString), ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpMessage, __toString, toString, HTTP_ARGS(HttpMessage, __toString), ZEND_ACC_PUBLIC) HTTP_MESSAGE_ME(factory, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_MALIAS(HttpMessage, fromString, factory, HTTP_ARGS(HttpMessage, factory), ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -428,8 +429,13 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type } ALLOC_ZVAL(return_value); +#ifdef Z_SET_REFCOUNT + Z_SET_REFCOUNT_P(return_value, 0); + Z_UNSET_ISREF_P(return_value); +#else return_value->refcount = 0; return_value->is_ref = 0; +#endif #ifdef WONKY switch (h) diff --git a/http_querystring_object.c b/http_querystring_object.c index d30cc1b..9c183f3 100644 --- a/http_querystring_object.c +++ b/http_querystring_object.c @@ -247,8 +247,13 @@ static inline zval *_http_querystring_instantiate(zval *this_ptr, zend_bool glob zend_update_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, qarray TSRMLS_CC); zend_update_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, qstring TSRMLS_CC); +#ifdef Z_SET_ISREF + Z_SET_ISREF_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC)); + Z_SET_ISREF_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); +#else zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC)->is_ref = 1; zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)->is_ref = 1; +#endif if (params) { http_querystring_modify(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC), params); @@ -258,7 +263,7 @@ static inline zval *_http_querystring_instantiate(zval *this_ptr, zend_bool glob } } } else { - qarray = ecalloc(1, sizeof(zval)); + MAKE_STD_ZVAL(qarray); array_init(qarray); zend_update_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, qarray TSRMLS_CC); @@ -267,6 +272,8 @@ static inline zval *_http_querystring_instantiate(zval *this_ptr, zend_bool glob if (params && http_querystring_modify(qarray, params) && !defer_update) { http_querystring_update(qarray, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } + + zval_ptr_dtor(&qarray); } return this_ptr; diff --git a/missing.h b/missing.h index 1ad4b2a..703f2b1 100644 --- a/missing.h +++ b/missing.h @@ -55,6 +55,10 @@ # endif #endif +#ifndef ZVAL_ADDREF +# define ZVAL_ADDREF Z_ADDREF_P +#endif + #ifndef ZVAL_ZVAL #define ZVAL_ZVAL(z, zv, copy, dtor) { \ int is_ref, refcount; \ diff --git a/package2.xml b/package2.xml index aebc027..c538a73 100644 --- a/package2.xml +++ b/package2.xml @@ -28,9 +28,9 @@ support. Parallel requests are available for PHP 5 and greater. mike@php.net yes - 2007-11-26 + 2008-02-04 - 1.6.0 + 1.6.1 1.6.0 @@ -39,20 +39,7 @@ support. Parallel requests are available for PHP 5 and greater. BSD, revised = 7.17.1) -+ Added constant HTTP_URL_FROM_ENV -+ Added 'retrycount' and 'retrydelay' request options -+ Added libevent support for libcurl (>= 7.16.0): - o added --with-http-curl-libevent configure option - o added HttpRequestPool::enableEvents() -* Fixed problems with cookiestore request option introduced with persistent handles -* Fixed crash on prematurely called HttpMessage::next() -* Fixed possible shutdown crash with http_parse_params() and PHP4 -* Fixed a possible crash at module shutdown in the persistent handle API - (probably fixing bug #11509) -* Fixed test suite for PHP4 -* Fixed missing PHP_LIBDIR definition in config.m4 for PHP4 -* Fixed non-standard shell support in config.m4 +* Fixed PHP-5.3 build ]]> diff --git a/php_http.h b/php_http.h index 6c16d65..b561d1d 100644 --- a/php_http.h +++ b/php_http.h @@ -15,7 +15,7 @@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_EXT_HTTP_VERSION "1.6.0" +#define PHP_EXT_HTTP_VERSION "1.6.1" #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/php_http_api.h b/php_http_api.h index 7163dc1..809f142 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -296,8 +296,13 @@ static inline zval *_zval_copy(int type, zval *z ZEND_FILE_LINE_DC ZEND_FILE_LIN *copy = *z; zval_copy_ctor(copy); convert_to_type(type, copy); +#ifdef Z_SET_REFCOUNT + Z_SET_REFCOUNT_P(copy, 0); + Z_UNSET_ISREF_P(copy); +#else copy->refcount = 0; copy->is_ref = 0; +#endif return copy; } -- 2.30.2