From 8e6cf53b544342e1eaf0ec4f530e32852120294a Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 22 Feb 2007 11:04:37 +0000 Subject: [PATCH] - removed error prone macros, fixes bug #10151 (build fails dynamic linking on Mac OS X) --- http_deflatestream_object.c | 30 ++-- http_inflatestream_object.c | 8 +- http_message_object.c | 26 ++-- http_querystring_api.c | 4 +- http_querystring_object.c | 70 ++++----- http_request_object.c | 254 ++++++++++++++++----------------- http_requestdatashare_object.c | 28 ++-- http_response_object.c | 160 ++++++++++----------- package2.xml | 6 +- php_http.h | 2 +- php_http_std_defs.h | 29 +--- 11 files changed, 296 insertions(+), 321 deletions(-) diff --git a/http_deflatestream_object.c b/http_deflatestream_object.c index 601c6a3..01e8ae2 100644 --- a/http_deflatestream_object.c +++ b/http_deflatestream_object.c @@ -47,7 +47,7 @@ HTTP_BEGIN_ARGS(finish, 0) HTTP_ARG_VAL(data, 0) HTTP_END_ARGS; -#define OBJ_PROP_CE http_deflatestream_object_ce +#define THIS_CE http_deflatestream_object_ce zend_class_entry *http_deflatestream_object_ce; zend_function_entry http_deflatestream_object_fe[] = { HTTP_DEFLATE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) @@ -67,20 +67,20 @@ PHP_MINIT_FUNCTION(http_deflatestream_object) http_deflatestream_object_handlers.clone_obj = _http_deflatestream_object_clone_obj; #ifndef WONKY - DCL_CONST(long, "TYPE_GZIP", HTTP_DEFLATE_TYPE_GZIP); - DCL_CONST(long, "TYPE_ZLIB", HTTP_DEFLATE_TYPE_ZLIB); - DCL_CONST(long, "TYPE_RAW", HTTP_DEFLATE_TYPE_RAW); - DCL_CONST(long, "LEVEL_DEF", HTTP_DEFLATE_LEVEL_DEF); - DCL_CONST(long, "LEVEL_MIN", HTTP_DEFLATE_LEVEL_MIN); - DCL_CONST(long, "LEVEL_MAX", HTTP_DEFLATE_LEVEL_MAX); - DCL_CONST(long, "STRATEGY_DEF", HTTP_DEFLATE_STRATEGY_DEF); - DCL_CONST(long, "STRATEGY_FILT", HTTP_DEFLATE_STRATEGY_FILT); - DCL_CONST(long, "STRATEGY_HUFF", HTTP_DEFLATE_STRATEGY_HUFF); - DCL_CONST(long, "STRATEGY_RLE", HTTP_DEFLATE_STRATEGY_RLE); - DCL_CONST(long, "STRATEGY_FIXED", HTTP_DEFLATE_STRATEGY_FIXED); - DCL_CONST(long, "FLUSH_NONE", HTTP_ENCODING_STREAM_FLUSH_NONE); - DCL_CONST(long, "FLUSH_SYNC", HTTP_ENCODING_STREAM_FLUSH_SYNC); - DCL_CONST(long, "FLUSH_FULL", HTTP_ENCODING_STREAM_FLUSH_FULL); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_GZIP")-1, HTTP_DEFLATE_TYPE_GZIP TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_ZLIB")-1, HTTP_DEFLATE_TYPE_ZLIB TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_RAW")-1, HTTP_DEFLATE_TYPE_RAW TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("LEVEL_DEF")-1, HTTP_DEFLATE_LEVEL_DEF TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("LEVEL_MIN")-1, HTTP_DEFLATE_LEVEL_MIN TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("LEVEL_MAX")-1, HTTP_DEFLATE_LEVEL_MAX TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("STRATEGY_DEF")-1, HTTP_DEFLATE_STRATEGY_DEF TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("STRATEGY_FILT")-1, HTTP_DEFLATE_STRATEGY_FILT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("STRATEGY_HUFF")-1, HTTP_DEFLATE_STRATEGY_HUFF TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("STRATEGY_RLE")-1, HTTP_DEFLATE_STRATEGY_RLE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("STRATEGY_FIXED")-1, HTTP_DEFLATE_STRATEGY_FIXED TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_NONE")-1, HTTP_ENCODING_STREAM_FLUSH_NONE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_SYNC")-1, HTTP_ENCODING_STREAM_FLUSH_SYNC TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_FULL")-1, HTTP_ENCODING_STREAM_FLUSH_FULL TSRMLS_CC); #endif return SUCCESS; diff --git a/http_inflatestream_object.c b/http_inflatestream_object.c index 61946b0..acd1257 100644 --- a/http_inflatestream_object.c +++ b/http_inflatestream_object.c @@ -47,7 +47,7 @@ HTTP_BEGIN_ARGS(finish, 0) HTTP_ARG_VAL(data, 0) HTTP_END_ARGS; -#define OBJ_PROP_CE http_inflatestream_object_ce +#define THIS_CE http_inflatestream_object_ce zend_class_entry *http_inflatestream_object_ce; zend_function_entry http_inflatestream_object_fe[] = { HTTP_INFLATE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) @@ -67,9 +67,9 @@ PHP_MINIT_FUNCTION(http_inflatestream_object) http_inflatestream_object_handlers.clone_obj = _http_inflatestream_object_clone_obj; #ifndef WONKY - DCL_CONST(long, "FLUSH_NONE", HTTP_ENCODING_STREAM_FLUSH_NONE); - DCL_CONST(long, "FLUSH_SYNC", HTTP_ENCODING_STREAM_FLUSH_SYNC); - DCL_CONST(long, "FLUSH_FULL", HTTP_ENCODING_STREAM_FLUSH_FULL); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_NONE")-1, HTTP_ENCODING_STREAM_FLUSH_NONE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_SYNC")-1, HTTP_ENCODING_STREAM_FLUSH_SYNC TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("FLUSH_FULL")-1, HTTP_ENCODING_STREAM_FLUSH_FULL TSRMLS_CC); #endif return SUCCESS; diff --git a/http_message_object.c b/http_message_object.c index 4ad0916..c5a219f 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -150,7 +150,7 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va #define http_message_object_get_props _http_message_object_get_props static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC); -#define OBJ_PROP_CE http_message_object_ce +#define THIS_CE http_message_object_ce zend_class_entry *http_message_object_ce; zend_function_entry http_message_object_fe[] = { HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) @@ -228,20 +228,20 @@ PHP_MINIT_FUNCTION(http_message_object) http_message_object_handlers.get_properties = http_message_object_get_props; http_message_object_handlers.get_property_ptr_ptr = NULL; - DCL_PROP(PROTECTED, long, type, HTTP_MSG_NONE); - DCL_PROP(PROTECTED, string, body, ""); - DCL_PROP(PROTECTED, string, requestMethod, ""); - DCL_PROP(PROTECTED, string, requestUrl, ""); - DCL_PROP(PROTECTED, string, responseStatus, ""); - DCL_PROP(PROTECTED, long, responseCode, 0); - DCL_PROP_N(PROTECTED, httpVersion); - DCL_PROP_N(PROTECTED, headers); - DCL_PROP_N(PROTECTED, parentMessage); + zend_declare_property_long(THIS_CE, ZEND_STRS("type")-1, HTTP_MSG_NONE, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("body")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("requestMethod")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("requestUrl")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("responseStatus")-1, "", ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("responseCode")-1, 0, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("httpVersion")-1, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("headers")-1, ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("parentMessage")-1, ZEND_ACC_PROTECTED TSRMLS_CC); #ifndef WONKY - DCL_CONST(long, "TYPE_NONE", HTTP_MSG_NONE); - DCL_CONST(long, "TYPE_REQUEST", HTTP_MSG_REQUEST); - DCL_CONST(long, "TYPE_RESPONSE", HTTP_MSG_RESPONSE); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_NONE")-1, HTTP_MSG_NONE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_REQUEST")-1, HTTP_MSG_REQUEST TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_RESPONSE")-1, HTTP_MSG_RESPONSE TSRMLS_CC); #endif HTTP_LONG_CONSTANT("HTTP_MSG_NONE", HTTP_MSG_NONE); diff --git a/http_querystring_api.c b/http_querystring_api.c index c083685..899715d 100644 --- a/http_querystring_api.c +++ b/http_querystring_api.c @@ -27,7 +27,7 @@ #include "php_http_querystring_api.h" #ifdef ZEND_ENGINE_2 -#define OBJ_PROP_CE http_querystring_object_ce +#define THIS_CE http_querystring_object_ce extern zend_class_entry *http_querystring_object_ce; #endif @@ -123,7 +123,7 @@ PHP_HTTP_API int _http_querystring_modify(zval *qarray, zval *params TSRMLS_DC) return http_querystring_modify_array(qarray, &temp_array); #ifdef ZEND_ENGINE_2 } - return http_querystring_modify_array(qarray, GET_PROP_EX(params, queryArray)); + return http_querystring_modify_array(qarray, zend_read_property(THIS_CE, params, ZEND_STRS("queryArray")-1, 0 TSRMLS_CC)); #endif } else { int rv; diff --git a/http_querystring_object.c b/http_querystring_object.c index 39e3b89..d30cc1b 100644 --- a/http_querystring_object.c +++ b/http_querystring_object.c @@ -101,7 +101,7 @@ HTTP_BEGIN_ARGS(offsetUnset, 1) HTTP_END_ARGS; -#define OBJ_PROP_CE http_querystring_object_ce +#define THIS_CE http_querystring_object_ce zend_class_entry *http_querystring_object_ce; zend_function_entry http_querystring_object_fe[] = { HTTP_QUERYSTRING_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL) @@ -151,17 +151,17 @@ PHP_MINIT_FUNCTION(http_querystring_object) zend_class_implements(http_querystring_object_ce TSRMLS_CC, 2, zend_ce_serializable, zend_ce_arrayaccess); #endif - DCL_STATIC_PROP_N(PRIVATE, instance); - DCL_PROP_N(PRIVATE, queryArray); - DCL_PROP(PRIVATE, string, queryString, ""); + zend_declare_property_null(THIS_CE, ZEND_STRS("instance")-1, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("queryArray")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("queryString")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); #ifndef WONKY - DCL_CONST(long, "TYPE_BOOL", HTTP_QUERYSTRING_TYPE_BOOL); - DCL_CONST(long, "TYPE_INT", HTTP_QUERYSTRING_TYPE_INT); - DCL_CONST(long, "TYPE_FLOAT", HTTP_QUERYSTRING_TYPE_FLOAT); - DCL_CONST(long, "TYPE_STRING", HTTP_QUERYSTRING_TYPE_STRING); - DCL_CONST(long, "TYPE_ARRAY", HTTP_QUERYSTRING_TYPE_ARRAY); - DCL_CONST(long, "TYPE_OBJECT", HTTP_QUERYSTRING_TYPE_OBJECT); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_BOOL")-1, HTTP_QUERYSTRING_TYPE_BOOL TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_INT")-1, HTTP_QUERYSTRING_TYPE_INT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_FLOAT")-1, HTTP_QUERYSTRING_TYPE_FLOAT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_STRING")-1, HTTP_QUERYSTRING_TYPE_STRING TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_ARRAY")-1, HTTP_QUERYSTRING_TYPE_ARRAY TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("TYPE_OBJECT")-1, HTTP_QUERYSTRING_TYPE_OBJECT TSRMLS_CC); #endif HTTP_LONG_CONSTANT("HTTP_QUERYSTRING_TYPE_BOOL", HTTP_QUERYSTRING_TYPE_BOOL); @@ -245,27 +245,27 @@ static inline zval *_http_querystring_instantiate(zval *this_ptr, zend_bool glob convert_to_string(qstring); } - SET_PROP(queryArray, qarray); - SET_PROP(queryString, qstring); - GET_PROP(queryArray)->is_ref = 1; - GET_PROP(queryString)->is_ref = 1; + 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); + 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; if (params) { - http_querystring_modify(GET_PROP(queryArray), params); + http_querystring_modify(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC), params); } if (!defer_update) { - http_querystring_update(GET_PROP(queryArray), GET_PROP(queryString)); + http_querystring_update(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC), zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } } } else { qarray = ecalloc(1, sizeof(zval)); array_init(qarray); - SET_PROP(queryArray, qarray); - UPD_STRL(queryString, "", 0); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, qarray TSRMLS_CC); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("queryString")-1, "", 0 TSRMLS_CC); if (params && http_querystring_modify(qarray, params) && !defer_update) { - http_querystring_update(qarray, GET_PROP(queryString)); + http_querystring_update(qarray, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } } @@ -275,7 +275,7 @@ static inline zval *_http_querystring_instantiate(zval *this_ptr, zend_bool glob #define http_querystring_get(o, t, n, l, def, del, r) _http_querystring_get((o), (t), (n), (l), (def), (del), (r) TSRMLS_CC) static inline void _http_querystring_get(zval *this_ptr, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC) { - zval **arrval, *qarray = GET_PROP(queryArray); + zval **arrval, *qarray = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC); if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) { RETVAL_ZVAL(*arrval, 1, 0); @@ -285,7 +285,7 @@ static inline void _http_querystring_get(zval *this_ptr, int type, char *name, u } if (del && (SUCCESS == zend_hash_del(Z_ARRVAL_P(qarray), name, name_len + 1))) { - http_querystring_update(qarray, GET_PROP(queryString)); + http_querystring_update(qarray, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } } else if(defval) { RETURN_ZVAL(defval, 1, 0); @@ -397,9 +397,9 @@ PHP_METHOD(HttpQueryString, set) zval *params; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) { - zval *qarray = GET_PROP(queryArray); + zval *qarray = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC); if (http_querystring_modify(qarray, params)) { - http_querystring_update(qarray, GET_PROP(queryString)); + http_querystring_update(qarray, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } } @@ -416,9 +416,9 @@ PHP_METHOD(HttpQueryString, mod) zval *zobj, *qarr, *qstr, *params; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) { - zobj = http_querystring_instantiate(NULL, 0, GET_PROP(queryArray), 1); - qarr = GET_PROP_EX(zobj, queryArray); - qstr = GET_PROP_EX(zobj, queryString); + zobj = http_querystring_instantiate(NULL, 0, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC), 1); + qarr = zend_read_property(THIS_CE, zobj, ZEND_STRS("queryArray")-1, 0 TSRMLS_CC); + qstr = zend_read_property(THIS_CE, zobj, ZEND_STRS("queryString")-1, 0 TSRMLS_CC); http_querystring_modify(qarr, params); http_querystring_update(qarr, qstr); @@ -434,7 +434,7 @@ PHP_METHOD(HttpQueryString, mod) PHP_METHOD(HttpQueryString, singleton) { zend_bool global = 1; - zval *instance = GET_STATIC_PROP(instance); + zval *instance = *zend_std_get_static_property(THIS_CE, ZEND_STRS("instance")-1, 0 TSRMLS_CC); SET_EH_THROW_HTTP(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &global)) { @@ -456,7 +456,7 @@ PHP_METHOD(HttpQueryString, singleton) add_index_zval(instance, global, zobj); RETVAL_OBJECT(zobj, 1); - SET_STATIC_PROP(instance, instance); + zend_update_static_property(THIS_CE, ZEND_STRS("instance")-1, instance TSRMLS_CC); zval_ptr_dtor(&instance); } } @@ -499,8 +499,8 @@ PHP_METHOD(HttpQueryString, xlate) RETURN_FALSE; } - qa = GET_PROP(queryArray); - qs = GET_PROP(queryString); + qa = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC); + qs = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC); INIT_PZVAL(&xa); array_init(&xa); @@ -552,7 +552,7 @@ PHP_METHOD(HttpQueryString, offsetGet) zval **value; if ( (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) && - (SUCCESS == zend_hash_find(Z_ARRVAL_P(GET_PROP(queryArray)), offset_str, offset_len + 1, (void *) &value))) { + (SUCCESS == zend_hash_find(Z_ARRVAL_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC)), offset_str, offset_len + 1, (void *) &value))) { RETVAL_ZVAL(*value, 1, 0); } } @@ -567,7 +567,7 @@ PHP_METHOD(HttpQueryString, offsetSet) zval *value; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &offset_str, &offset_len, &value)) { - zval *qarr = GET_PROP(queryArray), *qstr = GET_PROP(queryString); + zval *qarr = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC), *qstr = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC); ZVAL_ADDREF(value); add_assoc_zval_ex(qarr, offset_str, offset_len + 1, value); @@ -585,7 +585,7 @@ PHP_METHOD(HttpQueryString, offsetExists) zval **value; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) { - RETURN_BOOL((SUCCESS == zend_hash_find(Z_ARRVAL_P(GET_PROP(queryArray)), offset_str, offset_len + 1, (void *) &value)) && (Z_TYPE_PP(value) != IS_NULL)); + RETURN_BOOL((SUCCESS == zend_hash_find(Z_ARRVAL_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC)), offset_str, offset_len + 1, (void *) &value)) && (Z_TYPE_PP(value) != IS_NULL)); } } /* }}} */ @@ -598,10 +598,10 @@ PHP_METHOD(HttpQueryString, offsetUnset) int offset_len; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) { - zval *qarr = GET_PROP(queryArray); + zval *qarr = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryArray")-1, 0 TSRMLS_CC); if (SUCCESS == zend_hash_del(Z_ARRVAL_P(qarr), offset_str, offset_len + 1)) { - http_querystring_update(qarr, GET_PROP(queryString)); + http_querystring_update(qarr, zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryString")-1, 0 TSRMLS_CC)); } } } diff --git a/http_request_object.c b/http_request_object.c index 49e9103..1b2a543 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -249,7 +249,7 @@ HTTP_BEGIN_ARGS(encodeBody, 2) HTTP_END_ARGS; #endif -#define OBJ_PROP_CE http_request_object_ce +#define THIS_CE http_request_object_ce zend_class_entry *http_request_object_ce; zend_function_entry http_request_object_fe[] = { HTTP_REQUEST_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) @@ -350,99 +350,99 @@ PHP_MINIT_FUNCTION(http_request_object) HTTP_REGISTER_CLASS_EX(HttpRequest, http_request_object, NULL, 0); http_request_object_handlers.clone_obj = _http_request_object_clone_obj; - DCL_PROP_N(PRIVATE, options); - DCL_PROP_N(PRIVATE, postFields); - DCL_PROP_N(PRIVATE, postFiles); - DCL_PROP_N(PRIVATE, responseInfo); - DCL_PROP_N(PRIVATE, responseMessage); - DCL_PROP(PRIVATE, long, responseCode, 0); - DCL_PROP(PRIVATE, string, responseStatus, ""); - DCL_PROP(PRIVATE, long, method, HTTP_GET); - DCL_PROP(PRIVATE, string, url, ""); - DCL_PROP(PRIVATE, string, contentType, ""); - DCL_PROP(PRIVATE, string, requestBody, ""); - DCL_PROP(PRIVATE, string, queryData, ""); - DCL_PROP(PRIVATE, string, putFile, ""); - DCL_PROP(PRIVATE, string, putData, ""); - DCL_PROP_N(PRIVATE, history); - DCL_PROP(PUBLIC, bool, recordHistory, 0); + zend_declare_property_null(THIS_CE, ZEND_STRS("options")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("postFields")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("postFiles")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("responseInfo")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("responseMessage")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("responseCode")-1, 0, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("responseStatus")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("method")-1, HTTP_GET, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("url")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("contentType")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("requestBody")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("queryData")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("putFile")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_string(THIS_CE, ZEND_STRS("putData")-1, "", ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("history")-1, ZEND_ACC_PRIVATE TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("recordHistory")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); #ifndef WONKY /* * Request Method Constants */ /* HTTP/1.1 */ - DCL_CONST(long, "METH_GET", HTTP_GET); - DCL_CONST(long, "METH_HEAD", HTTP_HEAD); - DCL_CONST(long, "METH_POST", HTTP_POST); - DCL_CONST(long, "METH_PUT", HTTP_PUT); - DCL_CONST(long, "METH_DELETE", HTTP_DELETE); - DCL_CONST(long, "METH_OPTIONS", HTTP_OPTIONS); - DCL_CONST(long, "METH_TRACE", HTTP_TRACE); - DCL_CONST(long, "METH_CONNECT", HTTP_CONNECT); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_GET")-1, HTTP_GET TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_HEAD")-1, HTTP_HEAD TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_POST")-1, HTTP_POST TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_PUT")-1, HTTP_PUT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_DELETE")-1, HTTP_DELETE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_OPTIONS")-1, HTTP_OPTIONS TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_TRACE")-1, HTTP_TRACE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_CONNECT")-1, HTTP_CONNECT TSRMLS_CC); /* WebDAV - RFC 2518 */ - DCL_CONST(long, "METH_PROPFIND", HTTP_PROPFIND); - DCL_CONST(long, "METH_PROPPATCH", HTTP_PROPPATCH); - DCL_CONST(long, "METH_MKCOL", HTTP_MKCOL); - DCL_CONST(long, "METH_COPY", HTTP_COPY); - DCL_CONST(long, "METH_MOVE", HTTP_MOVE); - DCL_CONST(long, "METH_LOCK", HTTP_LOCK); - DCL_CONST(long, "METH_UNLOCK", HTTP_UNLOCK); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_PROPFIND")-1, HTTP_PROPFIND TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_PROPPATCH")-1, HTTP_PROPPATCH TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_MKCOL")-1, HTTP_MKCOL TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_COPY")-1, HTTP_COPY TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_MOVE")-1, HTTP_MOVE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_LOCK")-1, HTTP_LOCK TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_UNLOCK")-1, HTTP_UNLOCK TSRMLS_CC); /* WebDAV Versioning - RFC 3253 */ - DCL_CONST(long, "METH_VERSION_CONTROL", HTTP_VERSION_CONTROL); - DCL_CONST(long, "METH_REPORT", HTTP_REPORT); - DCL_CONST(long, "METH_CHECKOUT", HTTP_CHECKOUT); - DCL_CONST(long, "METH_CHECKIN", HTTP_CHECKIN); - DCL_CONST(long, "METH_UNCHECKOUT", HTTP_UNCHECKOUT); - DCL_CONST(long, "METH_MKWORKSPACE", HTTP_MKWORKSPACE); - DCL_CONST(long, "METH_UPDATE", HTTP_UPDATE); - DCL_CONST(long, "METH_LABEL", HTTP_LABEL); - DCL_CONST(long, "METH_MERGE", HTTP_MERGE); - DCL_CONST(long, "METH_BASELINE_CONTROL", HTTP_BASELINE_CONTROL); - DCL_CONST(long, "METH_MKACTIVITY", HTTP_MKACTIVITY); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_VERSION_CONTROL")-1, HTTP_VERSION_CONTROL TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_REPORT")-1, HTTP_REPORT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_CHECKOUT")-1, HTTP_CHECKOUT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_CHECKIN")-1, HTTP_CHECKIN TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_UNCHECKOUT")-1, HTTP_UNCHECKOUT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_MKWORKSPACE")-1, HTTP_MKWORKSPACE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_UPDATE")-1, HTTP_UPDATE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_LABEL")-1, HTTP_LABEL TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_MERGE")-1, HTTP_MERGE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_BASELINE_CONTROL")-1, HTTP_BASELINE_CONTROL TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_MKACTIVITY")-1, HTTP_MKACTIVITY TSRMLS_CC); /* WebDAV Access Control - RFC 3744 */ - DCL_CONST(long, "METH_ACL", HTTP_ACL); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("METH_ACL")-1, HTTP_ACL TSRMLS_CC); /* * HTTP Protocol Version Constants */ - DCL_CONST(long, "VERSION_1_0", CURL_HTTP_VERSION_1_0); - DCL_CONST(long, "VERSION_1_1", CURL_HTTP_VERSION_1_1); - DCL_CONST(long, "VERSION_NONE", CURL_HTTP_VERSION_NONE); /* to be removed */ - DCL_CONST(long, "VERSION_ANY", CURL_HTTP_VERSION_NONE); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("VERSION_1_0")-1, CURL_HTTP_VERSION_1_0 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("VERSION_1_1")-1, CURL_HTTP_VERSION_1_1 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("VERSION_NONE")-1, CURL_HTTP_VERSION_NONE TSRMLS_CC); /* to be removed */ + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("VERSION_ANY")-1, CURL_HTTP_VERSION_NONE TSRMLS_CC); /* * SSL Version Constants */ - DCL_CONST(long, "SSL_VERSION_TLSv1", CURL_SSLVERSION_TLSv1); - DCL_CONST(long, "SSL_VERSION_SSLv2", CURL_SSLVERSION_SSLv2); - DCL_CONST(long, "SSL_VERSION_SSLv3", CURL_SSLVERSION_SSLv3); - DCL_CONST(long, "SSL_VERSION_ANY", CURL_SSLVERSION_DEFAULT); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("SSL_VERSION_TLSv1")-1, CURL_SSLVERSION_TLSv1 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("SSL_VERSION_SSLv2")-1, CURL_SSLVERSION_SSLv2 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("SSL_VERSION_SSLv3")-1, CURL_SSLVERSION_SSLv3 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("SSL_VERSION_ANY")-1, CURL_SSLVERSION_DEFAULT TSRMLS_CC); /* * DNS IPvX resolving */ - DCL_CONST(long, "IPRESOLVE_V4", CURL_IPRESOLVE_V4); - DCL_CONST(long, "IPRESOLVE_V6", CURL_IPRESOLVE_V6); - DCL_CONST(long, "IPRESOLVE_ANY", CURL_IPRESOLVE_WHATEVER); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("IPRESOLVE_V4")-1, CURL_IPRESOLVE_V4 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("IPRESOLVE_V6")-1, CURL_IPRESOLVE_V6 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("IPRESOLVE_ANY")-1, CURL_IPRESOLVE_WHATEVER TSRMLS_CC); /* * Auth Constants */ - DCL_CONST(long, "AUTH_BASIC", CURLAUTH_BASIC); - DCL_CONST(long, "AUTH_DIGEST", CURLAUTH_DIGEST); - DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM); - DCL_CONST(long, "AUTH_GSSNEG", CURLAUTH_GSSNEGOTIATE); - DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_BASIC")-1, CURLAUTH_BASIC TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_DIGEST")-1, CURLAUTH_DIGEST TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_NTLM")-1, CURLAUTH_NTLM TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_GSSNEG")-1, CURLAUTH_GSSNEGOTIATE TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("AUTH_ANY")-1, CURLAUTH_ANY TSRMLS_CC); /* * Proxy Type Constants */ # if HTTP_CURL_VERSION(7,15,2) - DCL_CONST(long, "PROXY_SOCKS4", CURLPROXY_SOCKS4); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_SOCKS4")-1, CURLPROXY_SOCKS4 TSRMLS_CC); # endif - DCL_CONST(long, "PROXY_SOCKS5", CURLPROXY_SOCKS5); - DCL_CONST(long, "PROXY_HTTP", CURLPROXY_HTTP); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_SOCKS5")-1, CURLPROXY_SOCKS5 TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("PROXY_HTTP")-1, CURLPROXY_HTTP TSRMLS_CC); #endif /* WONKY */ return SUCCESS; @@ -505,10 +505,10 @@ void _http_request_object_free(zend_object *object TSRMLS_DC) #define http_request_object_check_request_content_type(t) _http_request_object_check_request_content_type((t) TSRMLS_CC) static inline void _http_request_object_check_request_content_type(zval *this_ptr TSRMLS_DC) { - zval *ctype = GET_PROP(contentType); + zval *ctype = zend_read_property(THIS_CE, getThis(), ZEND_STRS("contentType")-1, 0 TSRMLS_CC); if (Z_STRLEN_P(ctype)) { - zval **headers, *opts = GET_PROP(options); + zval **headers, *opts = zend_read_property(THIS_CE, getThis(), ZEND_STRS("options")-1, 0 TSRMLS_CC); if ( (Z_TYPE_P(opts) == IS_ARRAY) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), "headers", sizeof("headers"), (void *) &headers)) && @@ -555,9 +555,9 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ http_request_reset(obj->request); HTTP_CHECK_CURL_INIT(obj->request->ch, http_curl_init(obj->request), return FAILURE); - obj->request->url = http_absolute_url(Z_STRVAL_P(GET_PROP(url))); + obj->request->url = http_absolute_url(Z_STRVAL_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("url")-1, 0 TSRMLS_CC))); - switch (obj->request->meth = Z_LVAL_P(GET_PROP(method))) + switch (obj->request->meth = Z_LVAL_P(zend_read_property(THIS_CE, getThis(), ZEND_STRS("method")-1, 0 TSRMLS_CC))) { case HTTP_GET: case HTTP_HEAD: @@ -565,7 +565,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ case HTTP_PUT: { - zval *put_file = GET_PROP(putFile); + zval *put_file = zend_read_property(THIS_CE, getThis(), ZEND_STRS("putFile")-1, 0 TSRMLS_CC); http_request_object_check_request_content_type(getThis()); @@ -579,7 +579,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ status = FAILURE; } } else { - zval *put_data = GET_PROP(putData); + zval *put_data = zend_read_property(THIS_CE, getThis(), ZEND_STRS("putData")-1, 0 TSRMLS_CC); obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_CSTRING, estrndup(Z_STRVAL_P(put_data), Z_STRLEN_P(put_data)), Z_STRLEN_P(put_data), 1); } @@ -590,14 +590,14 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ default: { /* check for raw request body */ - zval *raw_data = GET_PROP(requestBody); + zval *raw_data = zend_read_property(THIS_CE, getThis(), ZEND_STRS("requestBody")-1, 0 TSRMLS_CC); if (Z_STRLEN_P(raw_data)) { http_request_object_check_request_content_type(getThis()); obj->request->body = http_request_body_init_ex(obj->request->body, HTTP_REQUEST_BODY_CSTRING, estrndup(Z_STRVAL_P(raw_data), Z_STRLEN_P(raw_data)), Z_STRLEN_P(raw_data), 1); } else { - zval *zfields = GET_PROP(postFields), *zfiles = GET_PROP(postFiles); + zval *zfields = zend_read_property(THIS_CE, getThis(), ZEND_STRS("postFields")-1, 0 TSRMLS_CC), *zfiles = zend_read_property(THIS_CE, getThis(), ZEND_STRS("postFiles")-1, 0 TSRMLS_CC); HashTable *fields; HashTable *files; @@ -615,8 +615,8 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_ } if (status == SUCCESS) { - zval *qdata = GET_PROP(queryData); - zval *options = GET_PROP(options); + zval *qdata = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryData")-1, 0 TSRMLS_CC); + zval *options = zend_read_property(THIS_CE, getThis(), ZEND_STRS("options")-1, 0 TSRMLS_CC); if (Z_STRLEN_P(qdata)) { if (!strchr(obj->request->url, '?')) { @@ -660,7 +660,7 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this MAKE_STD_ZVAL(info); array_init(info); http_request_info(obj->request, Z_ARRVAL_P(info)); - SET_PROP(responseInfo, info); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("responseInfo")-1, info TSRMLS_CC); zval_ptr_dtor(&info); /* parse response message */ @@ -670,8 +670,8 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this if ((msg = http_message_parse(PHPSTR_VAL(&obj->request->conv.response), PHPSTR_LEN(&obj->request->conv.response)))) { zval *message; - if (zval_is_true(GET_PROP(recordHistory))) { - zval *hist, *history = GET_PROP(history); + if (zval_is_true(zend_read_property(THIS_CE, getThis(), ZEND_STRS("recordHistory")-1, 0 TSRMLS_CC))) { + zval *hist, *history = zend_read_property(THIS_CE, getThis(), ZEND_STRS("history")-1, 0 TSRMLS_CC); http_message *response = http_message_parse(PHPSTR_VAL(&obj->request->conv.response), PHPSTR_LEN(&obj->request->conv.response)); http_message *request = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)); @@ -680,16 +680,16 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this if (Z_TYPE_P(history) == IS_OBJECT) { http_message_object_prepend(hist, history); } - SET_PROP(history, hist); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("history")-1, hist TSRMLS_CC); zval_ptr_dtor(&hist); } - UPD_PROP(long, responseCode, msg->http.info.response.code); - UPD_PROP(string, responseStatus, STR_PTR(msg->http.info.response.status)); + zend_update_property_long(THIS_CE, getThis(), ZEND_STRS("responseCode")-1, msg->http.info.response.code TSRMLS_CC); + zend_update_property_string(THIS_CE, getThis(), ZEND_STRS("responseStatus")-1, STR_PTR(msg->http.info.response.status) TSRMLS_CC); MAKE_STD_ZVAL(message); ZVAL_OBJVAL(message, http_message_object_new_ex(http_message_object_ce, msg, NULL), 0); - SET_PROP(responseMessage, message); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, message TSRMLS_CC); zval_ptr_dtor(&message); ret = SUCCESS; @@ -699,25 +699,25 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this MAKE_STD_ZVAL(znull); ZVAL_NULL(znull); - SET_PROP(responseMessage, znull); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, znull TSRMLS_CC); zval_ptr_dtor(&znull); - UPD_PROP(long, responseCode, 0); - UPD_PROP(string, responseStatus, ""); + zend_update_property_long(THIS_CE, getThis(), ZEND_STRS("responseCode")-1, 0 TSRMLS_CC); + zend_update_property_string(THIS_CE, getThis(), ZEND_STRS("responseStatus")-1, "" TSRMLS_CC); /* append request message to history */ - if (zval_is_true(GET_PROP(recordHistory))) { + if (zval_is_true(zend_read_property(THIS_CE, getThis(), ZEND_STRS("recordHistory")-1, 0 TSRMLS_CC))) { http_message *request; if ((request = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)))) { - zval *hist, *history = GET_PROP(history); + zval *hist, *history = zend_read_property(THIS_CE, getThis(), ZEND_STRS("history")-1, 0 TSRMLS_CC); MAKE_STD_ZVAL(hist); ZVAL_OBJVAL(hist, http_message_object_new_ex(http_message_object_ce, request, NULL), 0); if (Z_TYPE_P(history) == IS_OBJECT) { http_message_object_prepend(hist, history); } - SET_PROP(history, hist); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("history")-1, hist TSRMLS_CC); zval_ptr_dtor(&hist); } } @@ -761,7 +761,7 @@ static inline void _http_request_object_set_options_subr(INTERNAL_FUNCTION_PARAM MAKE_STD_ZVAL(new_opts); array_init(new_opts); - old_opts = GET_PROP(options); + old_opts = zend_read_property(THIS_CE, getThis(), ZEND_STRS("options")-1, 0 TSRMLS_CC); if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL_P(new_opts)); } @@ -784,7 +784,7 @@ static inline void _http_request_object_set_options_subr(INTERNAL_FUNCTION_PARAM ZVAL_ADDREF(opts); add_assoc_zval_ex(new_opts, key, len, opts); } - SET_PROP(options, new_opts); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("options")-1, new_opts TSRMLS_CC); zval_ptr_dtor(&new_opts); RETURN_TRUE; @@ -799,7 +799,7 @@ static inline void _http_request_get_options_subr(INTERNAL_FUNCTION_PARAMETERS, if (return_value_used) { zval *opts, **options; - opts = GET_PROP(options); + opts = zend_read_property(THIS_CE, getThis(), ZEND_STRS("options")-1, 0 TSRMLS_CC); array_init(return_value); if ( (Z_TYPE_P(opts) == IS_ARRAY) && @@ -825,10 +825,10 @@ PHP_METHOD(HttpRequest, __construct) SET_EH_THROW_HTTP(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sla!", &URL, &URL_len, &meth, &options)) { if (URL) { - UPD_STRL(url, URL, URL_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("url")-1, URL, URL_len TSRMLS_CC); } if (meth > -1) { - UPD_PROP(long, method, meth); + zend_update_property_long(THIS_CE, getThis(), ZEND_STRS("method")-1, meth TSRMLS_CC); } if (options) { zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "setoptions", NULL, options); @@ -854,10 +854,10 @@ PHP_METHOD(HttpRequest, factory) RETVAL_OBJVAL(ov, 0); getThis() = return_value; if (URL) { - UPD_STRL(url, URL, URL_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("url")-1, URL, URL_len TSRMLS_CC); } if (meth > -1) { - UPD_PROP(long, method, meth); + zend_update_property_long(THIS_CE, getThis(), ZEND_STRS("method")-1, meth TSRMLS_CC); } if (options) { zend_call_method_with_1_params(&getThis(), Z_OBJCE_P(getThis()), NULL, "setoptions", NULL, options); @@ -883,7 +883,7 @@ PHP_METHOD(HttpRequest, setOptions) array_init(new_opts); if (!opts || !zend_hash_num_elements(Z_ARRVAL_P(opts))) { - SET_PROP(options, new_opts); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("options")-1, new_opts TSRMLS_CC); zval_ptr_dtor(&new_opts); RETURN_TRUE; } @@ -912,7 +912,7 @@ PHP_METHOD(HttpRequest, setOptions) getObject(http_request_object, obj); http_request_enable_cookies(obj->request); } else if (!strcasecmp(key.str, "recordHistory")) { - UPD_PROP(bool, recordHistory, 1); + zend_update_property_bool(THIS_CE, getThis(), ZEND_STRS("recordHistory")-1, 1 TSRMLS_CC); } else { ZVAL_ADDREF(*opt); add_assoc_zval_ex(add_opts, key.str, key.len, *opt); @@ -920,12 +920,12 @@ PHP_METHOD(HttpRequest, setOptions) } } - old_opts = GET_PROP(options); + old_opts = zend_read_property(THIS_CE, getThis(), ZEND_STRS("options")-1, 0 TSRMLS_CC); if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL_P(new_opts)); } array_join(Z_ARRVAL_P(add_opts), Z_ARRVAL_P(new_opts), 0, 0); - SET_PROP(options, new_opts); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("options")-1, new_opts TSRMLS_CC); zval_ptr_dtor(&new_opts); zval_ptr_dtor(&add_opts); @@ -1053,7 +1053,7 @@ PHP_METHOD(HttpRequest, setUrl) RETURN_FALSE; } - UPD_STRL(url, URL, URL_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("url")-1, URL, URL_len TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1080,7 +1080,7 @@ PHP_METHOD(HttpRequest, setMethod) RETURN_FALSE; } - UPD_PROP(long, method, meth); + zend_update_property_long(THIS_CE, getThis(), ZEND_STRS("method")-1, meth TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1111,7 +1111,7 @@ PHP_METHOD(HttpRequest, setContentType) if (ct_len) { HTTP_CHECK_CONTENT_TYPE(ctype, RETURN_FALSE); } - UPD_STRL(contentType, ctype, ct_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("contentType")-1, ctype, ct_len TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1139,7 +1139,7 @@ PHP_METHOD(HttpRequest, setQueryData) } if ((!qdata) || Z_TYPE_P(qdata) == IS_NULL) { - UPD_STRL(queryData, "", 0); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("queryData")-1, "", 0 TSRMLS_CC); } else if ((Z_TYPE_P(qdata) == IS_ARRAY) || (Z_TYPE_P(qdata) == IS_OBJECT)) { char *query_data = NULL; @@ -1147,13 +1147,13 @@ PHP_METHOD(HttpRequest, setQueryData) RETURN_FALSE; } - UPD_PROP(string, queryData, query_data); + zend_update_property_string(THIS_CE, getThis(), ZEND_STRS("queryData")-1, query_data TSRMLS_CC); efree(query_data); } else { zval *orig = qdata; convert_to_string_ex(&qdata); - UPD_STRL(queryData, Z_STRVAL_P(qdata), Z_STRLEN_P(qdata)); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("queryData")-1, Z_STRVAL_P(qdata), Z_STRLEN_P(qdata) TSRMLS_CC); if (orig != qdata) { zval_ptr_dtor(&qdata); } @@ -1186,13 +1186,13 @@ PHP_METHOD(HttpRequest, addQueryData) RETURN_FALSE; } - old_qdata = GET_PROP(queryData); + old_qdata = zend_read_property(THIS_CE, getThis(), ZEND_STRS("queryData")-1, 0 TSRMLS_CC); if (SUCCESS != http_urlencode_hash_ex(HASH_OF(qdata), 1, Z_STRVAL_P(old_qdata), Z_STRLEN_P(old_qdata), &query_data, &query_data_len)) { RETURN_FALSE; } - UPD_STRL(queryData, query_data, query_data_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("queryData")-1, query_data, query_data_len TSRMLS_CC); efree(query_data); RETURN_TRUE; @@ -1212,12 +1212,12 @@ PHP_METHOD(HttpRequest, addPostFields) if (zend_hash_num_elements(Z_ARRVAL_P(post_data))) { MAKE_STD_ZVAL(new_post); array_init(new_post); - old_post = GET_PROP(postFields); + old_post = zend_read_property(THIS_CE, getThis(), ZEND_STRS("postFields")-1, 0 TSRMLS_CC); if (Z_TYPE_P(old_post) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_post), Z_ARRVAL_P(new_post)); } array_join(Z_ARRVAL_P(post_data), Z_ARRVAL_P(new_post), 0, 0); - SET_PROP(postFields, new_post); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("postFields")-1, new_post TSRMLS_CC); zval_ptr_dtor(&new_post); } @@ -1240,7 +1240,7 @@ PHP_METHOD(HttpRequest, setPostFields) if (post_data && zend_hash_num_elements(Z_ARRVAL_P(post_data))) { array_copy(Z_ARRVAL_P(post_data), Z_ARRVAL_P(post)); } - SET_PROP(postFields, post); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("postFields")-1, post TSRMLS_CC); zval_ptr_dtor(&post); RETURN_TRUE; @@ -1274,7 +1274,7 @@ PHP_METHOD(HttpRequest, setBody) raw_data = ""; } - UPD_STRL(requestBody, raw_data, data_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("requestBody")-1, raw_data, data_len TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1291,14 +1291,14 @@ PHP_METHOD(HttpRequest, addBody) } if (data_len) { - zval *data = GET_PROP(rrequestBody); + zval *data = zend_read_property(THIS_CE, getThis(), ZEND_STRS("rrequestBody")-1, 0 TSRMLS_CC); if (Z_STRLEN_P(data)) { Z_STRVAL_P(data) = erealloc(Z_STRVAL_P(data), (Z_STRLEN_P(data) += data_len) + 1); Z_STRVAL_P(data)[Z_STRLEN_P(data)] = '\0'; memcpy(Z_STRVAL_P(data) + Z_STRLEN_P(data) - data_len, raw_data, data_len); } else { - UPD_STRL(putData, raw_data, data_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("putData")-1, raw_data, data_len TSRMLS_CC); } } @@ -1346,12 +1346,12 @@ PHP_METHOD(HttpRequest, addPostFile) MAKE_STD_ZVAL(new_post); array_init(new_post); - old_post = GET_PROP(postFiles); + old_post = zend_read_property(THIS_CE, getThis(), ZEND_STRS("postFiles")-1, 0 TSRMLS_CC); if (Z_TYPE_P(old_post) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_post), Z_ARRVAL_P(new_post)); } add_next_index_zval(new_post, entry); - SET_PROP(postFiles, new_post); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("postFiles")-1, new_post TSRMLS_CC); zval_ptr_dtor(&new_post); RETURN_TRUE; @@ -1373,7 +1373,7 @@ PHP_METHOD(HttpRequest, setPostFiles) if (files && (Z_TYPE_P(files) == IS_ARRAY)) { array_copy(Z_ARRVAL_P(files), Z_ARRVAL_P(post)); } - SET_PROP(postFiles, post); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("postFiles")-1, post TSRMLS_CC); zval_ptr_dtor(&post); RETURN_TRUE; @@ -1403,7 +1403,7 @@ PHP_METHOD(HttpRequest, setPutFile) RETURN_FALSE; } - UPD_STRL(putFile, file, file_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("putFile")-1, file, file_len TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1435,7 +1435,7 @@ PHP_METHOD(HttpRequest, setPutData) put_data = ""; } - UPD_STRL(putData, put_data, data_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("putData")-1, put_data, data_len TSRMLS_CC); RETURN_TRUE; } /* }}} */ @@ -1452,14 +1452,14 @@ PHP_METHOD(HttpRequest, addPutData) } if (data_len) { - zval *data = GET_PROP(putData); + zval *data = zend_read_property(THIS_CE, getThis(), ZEND_STRS("putData")-1, 0 TSRMLS_CC); if (Z_STRLEN_P(data)) { Z_STRVAL_P(data) = erealloc(Z_STRVAL_P(data), (Z_STRLEN_P(data) += data_len) + 1); Z_STRVAL_P(data)[Z_STRLEN_P(data)] = '\0'; memcpy(Z_STRVAL_P(data) + Z_STRLEN_P(data) - data_len, put_data, data_len); } else { - UPD_STRL(putData, put_data, data_len); + zend_update_property_stringl(THIS_CE, getThis(), ZEND_STRS("putData")-1, put_data, data_len TSRMLS_CC); } } @@ -1488,7 +1488,7 @@ PHP_METHOD(HttpRequest, getResponseData) if (return_value_used) { char *body; size_t body_len; - zval *headers, *message = GET_PROP(responseMessage); + zval *headers, *message = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC); if (Z_TYPE_P(message) == IS_OBJECT) { getObjectEx(http_message_object, msg, message); @@ -1517,7 +1517,7 @@ PHP_METHOD(HttpRequest, getResponseHeader) int header_len = 0; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &header_name, &header_len)) { - zval *message = GET_PROP(responseMessage); + zval *message = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC); if (Z_TYPE_P(message) == IS_OBJECT) { getObjectEx(http_message_object, msg, message); @@ -1550,7 +1550,7 @@ PHP_METHOD(HttpRequest, getResponseCookies) int i = 0; HashKey key = initHashKey(0); char **allowed_extras = NULL; - zval **header = NULL, **entry = NULL, *message = GET_PROP(responseMessage); + zval **header = NULL, **entry = NULL, *message = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC); HashPosition pos, pos1, pos2; if (Z_TYPE_P(message) == IS_OBJECT) { @@ -1628,7 +1628,7 @@ PHP_METHOD(HttpRequest, getResponseBody) NO_ARGS; if (return_value_used) { - zval *message = GET_PROP(responseMessage); + zval *message = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC); if (Z_TYPE_P(message) == IS_OBJECT) { getObjectEx(http_message_object, msg, message); @@ -1677,7 +1677,7 @@ PHP_METHOD(HttpRequest, getResponseInfo) RETURN_FALSE; } - info = GET_PROP(responseInfo); + info = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseInfo")-1, 0 TSRMLS_CC); if (Z_TYPE_P(info) != IS_ARRAY) { RETURN_FALSE; @@ -1705,7 +1705,7 @@ PHP_METHOD(HttpRequest, getResponseMessage) zval *message; SET_EH_THROW_HTTP(); - message = GET_PROP(responseMessage); + message = zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC); if (Z_TYPE_P(message) == IS_OBJECT) { RETVAL_OBJECT(message, 1); } else { @@ -1773,7 +1773,7 @@ PHP_METHOD(HttpRequest, getHistory) zval *hist; SET_EH_THROW_HTTP(); - hist = GET_PROP(history); + hist = zend_read_property(THIS_CE, getThis(), ZEND_STRS("history")-1, 0 TSRMLS_CC); if (Z_TYPE_P(hist) == IS_OBJECT) { RETVAL_OBJECT(hist, 1); } else { @@ -1793,7 +1793,7 @@ PHP_METHOD(HttpRequest, clearHistory) MAKE_STD_ZVAL(hist); ZVAL_NULL(hist); - SET_PROP(history, hist); + zend_update_property(THIS_CE, getThis(), ZEND_STRS("history")-1, hist TSRMLS_CC); zval_ptr_dtor(&hist); } } @@ -1816,7 +1816,7 @@ PHP_METHOD(HttpRequest, send) } else if (SUCCESS == http_request_object_requesthandler(obj, getThis())) { http_request_exec(obj->request); if (SUCCESS == http_request_object_responsehandler(obj, getThis())) { - RETVAL_OBJECT(GET_PROP(responseMessage), 1); + RETVAL_OBJECT(zend_read_property(THIS_CE, getThis(), ZEND_STRS("responseMessage")-1, 0 TSRMLS_CC), 1); } } diff --git a/http_requestdatashare_object.c b/http_requestdatashare_object.c index be2d68d..8b4a51d 100644 --- a/http_requestdatashare_object.c +++ b/http_requestdatashare_object.c @@ -66,7 +66,7 @@ static void _http_requestdatashare_object_write_prop(zval *object, zval *member, #define http_requestdatashare_instantiate(t, g) _http_requestdatashare_instantiate((t), (g) TSRMLS_CC) static inline zval *_http_requestdatashare_instantiate(zval *this_ptr, zend_bool global TSRMLS_DC); -#define OBJ_PROP_CE http_requestdatashare_object_ce +#define THIS_CE http_requestdatashare_object_ce zend_class_entry *http_requestdatashare_object_ce; zend_function_entry http_requestdatashare_object_fe[] = { HTTP_RSHARE_ME(__destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) @@ -93,11 +93,11 @@ PHP_MINIT_FUNCTION(http_requestdatashare_object) zend_class_implements(http_requestdatashare_object_ce TSRMLS_CC, 1, spl_ce_Countable); #endif - DCL_STATIC_PROP_N(PRIVATE, instance); - DCL_PROP(PUBLIC, bool, cookie, 0); - DCL_PROP(PUBLIC, bool, dns, 0); - DCL_PROP(PUBLIC, bool, ssl, 0); - DCL_PROP(PUBLIC, bool, connect, 0); + zend_declare_property_null(THIS_CE, ZEND_STRS("instance")-1, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("cookie")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("dns")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("ssl")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("connect")-1, 0, ZEND_ACC_PUBLIC TSRMLS_CC); return SUCCESS; } @@ -147,7 +147,7 @@ void _http_requestdatashare_object_free(zend_object *object TSRMLS_DC) static zval *_http_requestdatashare_object_read_prop(zval *object, zval *member, int type TSRMLS_DC) { - if (type == BP_VAR_W && zend_hash_exists(&OBJ_PROP_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) { + if (type == BP_VAR_W && zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) { zend_error(E_ERROR, "Cannot access HttpRequestDataShare default properties by reference or array key/index"); return NULL; } @@ -157,7 +157,7 @@ static zval *_http_requestdatashare_object_read_prop(zval *object, zval *member, static void _http_requestdatashare_object_write_prop(zval *object, zval *member, zval *value TSRMLS_DC) { - if (zend_hash_exists(&OBJ_PROP_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) { + if (zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) { int status; zval *orig = value; getObjectEx(http_requestdatashare_object, obj, object); @@ -253,7 +253,7 @@ PHP_METHOD(HttpRequestDataShare, factory) PHP_METHOD(HttpRequestDataShare, singleton) { zend_bool global = 0; - zval *instance = GET_STATIC_PROP(instance); + zval *instance = *zend_std_get_static_property(THIS_CE, ZEND_STRS("instance")-1, 0 TSRMLS_CC); SET_EH_THROW_HTTP(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &global)) { @@ -275,7 +275,7 @@ PHP_METHOD(HttpRequestDataShare, singleton) add_index_zval(instance, global, zobj); RETVAL_OBJECT(zobj, 1); - SET_STATIC_PROP(instance, instance); + zend_update_static_property(THIS_CE, ZEND_STRS("instance")-1, instance TSRMLS_CC); zval_ptr_dtor(&instance); } } @@ -293,16 +293,16 @@ static inline zval *_http_requestdatashare_instantiate(zval *this_ptr, zend_bool } if (global) { if (HTTP_G->request.datashare.cookie) { - UPD_PROP(bool, cookie, HTTP_G->request.datashare.cookie); + zend_update_property_bool(THIS_CE, getThis(), ZEND_STRS("cookie")-1, HTTP_G->request.datashare.cookie TSRMLS_CC); } if (HTTP_G->request.datashare.dns) { - UPD_PROP(bool, dns, HTTP_G->request.datashare.dns); + zend_update_property_bool(THIS_CE, getThis(), ZEND_STRS("dns")-1, HTTP_G->request.datashare.dns TSRMLS_CC); } if (HTTP_G->request.datashare.ssl) { - UPD_PROP(bool, ssl, HTTP_G->request.datashare.ssl); + zend_update_property_bool(THIS_CE, getThis(), ZEND_STRS("ssl")-1, HTTP_G->request.datashare.ssl TSRMLS_CC); } if (HTTP_G->request.datashare.connect) { - UPD_PROP(bool, connect, HTTP_G->request.datashare.connect); + zend_update_property_bool(THIS_CE, getThis(), ZEND_STRS("connect")-1, HTTP_G->request.datashare.connect TSRMLS_CC); } } return this_ptr; diff --git a/http_response_object.c b/http_response_object.c index 2bbef46..2360d68 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -132,7 +132,7 @@ HTTP_EMPTY_ARGS(getRequestHeaders); HTTP_EMPTY_ARGS(getRequestBody); HTTP_EMPTY_ARGS(getRequestBodyStream); -#define OBJ_PROP_CE http_response_object_ce +#define THIS_CE http_response_object_ce zend_class_entry *http_response_object_ce; zend_function_entry http_response_object_fe[] = { @@ -193,29 +193,29 @@ PHP_MINIT_FUNCTION(http_response_object) { HTTP_REGISTER_CLASS(HttpResponse, http_response_object, NULL, 0); - DCL_STATIC_PROP(PRIVATE, bool, sent, 0); - DCL_STATIC_PROP(PRIVATE, bool, catch, 0); - DCL_STATIC_PROP(PRIVATE, long, mode, -1); - DCL_STATIC_PROP(PRIVATE, long, stream, 0); - DCL_STATIC_PROP_N(PRIVATE, file); - DCL_STATIC_PROP_N(PRIVATE, data); - DCL_STATIC_PROP(PROTECTED, bool, cache, 0); - DCL_STATIC_PROP(PROTECTED, bool, gzip, 0); - DCL_STATIC_PROP_N(PROTECTED, eTag); - DCL_STATIC_PROP(PROTECTED, long, lastModified, 0); - DCL_STATIC_PROP_N(PROTECTED, cacheControl); - DCL_STATIC_PROP_N(PROTECTED, contentType); - DCL_STATIC_PROP_N(PROTECTED, contentDisposition); - DCL_STATIC_PROP(PROTECTED, long, bufferSize, 0); - DCL_STATIC_PROP(PROTECTED, double, throttleDelay, 0.0); + zend_declare_property_bool(THIS_CE, ZEND_STRS("sent")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("catch")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("mode")-1, -1, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("stream")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("file")-1, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("data")-1, (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("cache")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_bool(THIS_CE, ZEND_STRS("gzip")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("eTag")-1, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("lastModified")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("cacheControl")-1, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("contentType")-1, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_null(THIS_CE, ZEND_STRS("contentDisposition")-1, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_long(THIS_CE, ZEND_STRS("bufferSize")-1, 0, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_double(THIS_CE, ZEND_STRS("throttleDelay")-1, 0.0, (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); #ifndef WONKY - DCL_CONST(long, "REDIRECT", HTTP_REDIRECT); - DCL_CONST(long, "REDIRECT_PERM", HTTP_REDIRECT_PERM); - DCL_CONST(long, "REDIRECT_FOUND", HTTP_REDIRECT_FOUND); - DCL_CONST(long, "REDIRECT_POST", HTTP_REDIRECT_POST); - DCL_CONST(long, "REDIRECT_PROXY", HTTP_REDIRECT_PROXY); - DCL_CONST(long, "REDIRECT_TEMP", HTTP_REDIRECT_TEMP); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT")-1, HTTP_REDIRECT TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT_PERM")-1, HTTP_REDIRECT_PERM TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT_FOUND")-1, HTTP_REDIRECT_FOUND TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT_POST")-1, HTTP_REDIRECT_POST TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT_PROXY")-1, HTTP_REDIRECT_PROXY TSRMLS_CC); + zend_declare_class_constant_long(THIS_CE, ZEND_STRS("REDIRECT_TEMP")-1, HTTP_REDIRECT_TEMP TSRMLS_CC); #endif /* WONKY */ return SUCCESS; @@ -288,7 +288,7 @@ PHP_METHOD(HttpResponse, setCache) RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_PROP(bool, cache, do_cache)); + RETURN_SUCCESS(zend_update_static_property_bool(THIS_CE, ZEND_STRS("cache")-1, do_cache TSRMLS_CC)); } /* }}} */ @@ -299,7 +299,7 @@ PHP_METHOD(HttpResponse, getCache) NO_ARGS; if (return_value_used) { - zval *cache_p, *cache = convert_to_type_ex(IS_BOOL, GET_STATIC_PROP(cache), &cache_p); + zval *cache_p, *cache = convert_to_type_ex(IS_BOOL, *zend_std_get_static_property(THIS_CE, ZEND_STRS("cache")-1, 0 TSRMLS_CC), &cache_p); RETVAL_ZVAL(cache, 1, 0); @@ -320,7 +320,7 @@ PHP_METHOD(HttpResponse, setGzip) RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_PROP(bool, gzip, do_gzip)); + RETURN_SUCCESS(zend_update_static_property_bool(THIS_CE, ZEND_STRS("gzip")-1, do_gzip TSRMLS_CC)); } /* }}} */ @@ -331,7 +331,7 @@ PHP_METHOD(HttpResponse, getGzip) NO_ARGS; if (return_value_used) { - zval *gzip_p, *gzip = convert_to_type_ex(IS_BOOL, GET_STATIC_PROP(gzip), &gzip_p); + zval *gzip_p, *gzip = convert_to_type_ex(IS_BOOL, *zend_std_get_static_property(THIS_CE, ZEND_STRS("gzip")-1, 0 TSRMLS_CC), &gzip_p); RETVAL_ZVAL(gzip, 1, 0); @@ -360,7 +360,7 @@ PHP_METHOD(HttpResponse, setCacheControl) RETURN_FALSE; } else { size_t cctl_len = spprintf(&cctl, 0, "%s,%s max-age=%ld", ccontrol, must_revalidate?" must-revalidate,":"", max_age); - RETVAL_SUCCESS(UPD_STATIC_STRL(cacheControl, cctl, cctl_len)); + RETVAL_SUCCESS(zend_update_static_property_stringl(THIS_CE, ZEND_STRS("cacheControl")-1, cctl, cctl_len TSRMLS_CC)); efree(cctl); } } @@ -373,7 +373,7 @@ PHP_METHOD(HttpResponse, getCacheControl) NO_ARGS; if (return_value_used) { - zval *ccontrol_p, *ccontrol = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(cacheControl), &ccontrol_p); + zval *ccontrol_p, *ccontrol = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("cacheControl")-1, 0 TSRMLS_CC), &ccontrol_p); RETVAL_ZVAL(ccontrol, 1, 0); @@ -396,7 +396,7 @@ PHP_METHOD(HttpResponse, setContentType) } HTTP_CHECK_CONTENT_TYPE(ctype, RETURN_FALSE); - RETURN_SUCCESS(UPD_STATIC_STRL(contentType, ctype, ctype_len)); + RETURN_SUCCESS(zend_update_static_property_stringl(THIS_CE, ZEND_STRS("contentType")-1, ctype, ctype_len TSRMLS_CC)); } /* }}} */ @@ -407,7 +407,7 @@ PHP_METHOD(HttpResponse, getContentType) NO_ARGS; if (return_value_used) { - zval *ctype_p, *ctype = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(contentType), &ctype_p); + zval *ctype_p, *ctype = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("contentType")-1, 0 TSRMLS_CC), &ctype_p); RETVAL_ZVAL(ctype, 1, 0); @@ -430,10 +430,10 @@ PHP_METHOD(HttpResponse, guessContentType) RETVAL_FALSE; SET_EH_THROW_HTTP(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &magic_file, &magic_file_len, &magic_mode)) { - switch (Z_LVAL_P(GET_STATIC_PROP(mode))) { + switch (Z_LVAL_P(*zend_std_get_static_property(THIS_CE, ZEND_STRS("mode")-1, 0 TSRMLS_CC))) { case SEND_DATA: { - zval *data = GET_STATIC_PROP(data); + zval *data = *zend_std_get_static_property(THIS_CE, ZEND_STRS("data")-1, 0 TSRMLS_CC); ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(data), Z_STRLEN_P(data), SEND_DATA); break; } @@ -441,7 +441,7 @@ PHP_METHOD(HttpResponse, guessContentType) case SEND_RSRC: { php_stream *s; - zval *z = GET_STATIC_PROP(stream); + zval *z = *zend_std_get_static_property(THIS_CE, ZEND_STRS("stream")-1, 0 TSRMLS_CC); z->type = IS_RESOURCE; php_stream_from_zval(s, &z); ct = http_guess_content_type(magic_file, magic_mode, s, 0, SEND_RSRC); @@ -449,11 +449,11 @@ PHP_METHOD(HttpResponse, guessContentType) } default: - ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(GET_STATIC_PROP(file)), 0, -1); + ct = http_guess_content_type(magic_file, magic_mode, Z_STRVAL_P(*zend_std_get_static_property(THIS_CE, ZEND_STRS("file")-1, 0 TSRMLS_CC)), 0, -1); break; } if (ct) { - UPD_STATIC_PROP(string, contentType, ct); + zend_update_static_property_string(THIS_CE, ZEND_STRS("contentType")-1, ct TSRMLS_CC); RETVAL_STRING(ct, 0); } } @@ -479,7 +479,7 @@ PHP_METHOD(HttpResponse, setContentDisposition) } cd_len = spprintf(&cd, 0, "%s; filename=\"%s\"", send_inline ? "inline" : "attachment", file); - RETVAL_SUCCESS(UPD_STATIC_STRL(contentDisposition, cd, cd_len)); + RETVAL_SUCCESS(zend_update_static_property_stringl(THIS_CE, ZEND_STRS("contentDisposition")-1, cd, cd_len TSRMLS_CC)); efree(cd); } /* }}} */ @@ -491,7 +491,7 @@ PHP_METHOD(HttpResponse, getContentDisposition) NO_ARGS; if (return_value_used) { - zval *cd_p, *cd = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(contentDisposition), &cd_p); + zval *cd_p, *cd = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("contentDisposition")-1, 0 TSRMLS_CC), &cd_p); RETVAL_ZVAL(cd, 1, 0); @@ -513,7 +513,7 @@ PHP_METHOD(HttpResponse, setETag) RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_STRL(eTag, etag, etag_len)); + RETURN_SUCCESS(zend_update_static_property_stringl(THIS_CE, ZEND_STRS("eTag")-1, etag, etag_len TSRMLS_CC)); } /* }}} */ @@ -524,7 +524,7 @@ PHP_METHOD(HttpResponse, getETag) NO_ARGS; if (return_value_used) { - zval *etag_p, *etag = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(eTag), &etag_p); + zval *etag_p, *etag = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("eTag")-1, 0 TSRMLS_CC), &etag_p); RETVAL_ZVAL(etag, 1, 0); @@ -545,7 +545,7 @@ PHP_METHOD(HttpResponse, setLastModified) RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_PROP(long, lastModified, lm)); + RETURN_SUCCESS(zend_update_static_property_long(THIS_CE, ZEND_STRS("lastModified")-1, lm TSRMLS_CC)); } /* }}} */ @@ -556,7 +556,7 @@ PHP_METHOD(HttpResponse, getLastModified) NO_ARGS; if (return_value_used) { - zval *lm_p, *lm = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(lastModified), &lm_p); + zval *lm_p, *lm = convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("lastModified")-1, 0 TSRMLS_CC), &lm_p); RETVAL_ZVAL(lm, 1, 0); @@ -576,7 +576,7 @@ PHP_METHOD(HttpResponse, setThrottleDelay) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &seconds)) { RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_PROP(double, throttleDelay, seconds)); + RETURN_SUCCESS(zend_update_static_property_double(THIS_CE, ZEND_STRS("throttleDelay")-1, seconds TSRMLS_CC)); } /* }}} */ @@ -587,7 +587,7 @@ PHP_METHOD(HttpResponse, getThrottleDelay) NO_ARGS; if (return_value_used) { - zval *delay_p, *delay = convert_to_type_ex(IS_DOUBLE, GET_STATIC_PROP(throttleDelay), &delay_p); + zval *delay_p, *delay = convert_to_type_ex(IS_DOUBLE, *zend_std_get_static_property(THIS_CE, ZEND_STRS("throttleDelay")-1, 0 TSRMLS_CC), &delay_p); RETVAL_ZVAL(delay, 1, 0); @@ -607,7 +607,7 @@ PHP_METHOD(HttpResponse, setBufferSize) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &bytes)) { RETURN_FALSE; } - RETURN_SUCCESS(UPD_STATIC_PROP(long, bufferSize, bytes)); + RETURN_SUCCESS(zend_update_static_property_long(THIS_CE, ZEND_STRS("bufferSize")-1, bytes TSRMLS_CC)); } /* }}} */ @@ -618,7 +618,7 @@ PHP_METHOD(HttpResponse, getBufferSize) NO_ARGS; if (return_value_used) { - zval *size_p, *size = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(bufferSize), &size_p); + zval *size_p, *size = convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("bufferSize")-1, 0 TSRMLS_CC), &size_p); RETVAL_ZVAL(size, 1, 0); @@ -643,14 +643,14 @@ PHP_METHOD(HttpResponse, setData) convert_to_string_ex(&the_data); } - if ( (SUCCESS != SET_STATIC_PROP(data, the_data)) || - (SUCCESS != UPD_STATIC_PROP(long, mode, SEND_DATA))) { + if ( (SUCCESS != zend_update_static_property(THIS_CE, ZEND_STRS("data")-1, the_data TSRMLS_CC)) || + (SUCCESS != zend_update_static_property_long(THIS_CE, ZEND_STRS("mode")-1, SEND_DATA TSRMLS_CC))) { RETURN_FALSE; } - UPD_STATIC_PROP(long, lastModified, http_last_modified(the_data, SEND_DATA)); + zend_update_static_property_long(THIS_CE, ZEND_STRS("lastModified")-1, http_last_modified(the_data, SEND_DATA) TSRMLS_CC); if ((etag = http_etag(Z_STRVAL_P(the_data), Z_STRLEN_P(the_data), SEND_DATA))) { - UPD_STATIC_PROP(string, eTag, etag); + zend_update_static_property_string(THIS_CE, ZEND_STRS("eTag")-1, etag TSRMLS_CC); efree(etag); } @@ -665,7 +665,7 @@ PHP_METHOD(HttpResponse, getData) NO_ARGS; if (return_value_used) { - zval *the_data = GET_STATIC_PROP(data); + zval *the_data = *zend_std_get_static_property(THIS_CE, ZEND_STRS("data")-1, 0 TSRMLS_CC); RETURN_ZVAL(the_data, 1, 0); } @@ -690,15 +690,15 @@ PHP_METHOD(HttpResponse, setStream) RETURN_FALSE; } - if ( (SUCCESS != UPD_STATIC_PROP(long, stream, Z_LVAL_P(the_stream))) || - (SUCCESS != UPD_STATIC_PROP(long, mode, SEND_RSRC))) { + if ( (SUCCESS != zend_update_static_property_long(THIS_CE, ZEND_STRS("stream")-1, Z_LVAL_P(the_stream) TSRMLS_CC)) || + (SUCCESS != zend_update_static_property_long(THIS_CE, ZEND_STRS("mode")-1, SEND_RSRC TSRMLS_CC))) { RETURN_FALSE; } zend_list_addref(Z_LVAL_P(the_stream)); - UPD_STATIC_PROP(long, lastModified, http_last_modified(the_real_stream, SEND_RSRC)); + zend_update_static_property_long(THIS_CE, ZEND_STRS("lastModified")-1, http_last_modified(the_real_stream, SEND_RSRC) TSRMLS_CC); if ((etag = http_etag(the_real_stream, 0, SEND_RSRC))) { - UPD_STATIC_PROP(string, eTag, etag); + zend_update_static_property_string(THIS_CE, ZEND_STRS("eTag")-1, etag TSRMLS_CC); efree(etag); } @@ -715,7 +715,7 @@ PHP_METHOD(HttpResponse, getStream) if (return_value_used) { zval *stream_p; - RETVAL_RESOURCE(Z_LVAL_P(convert_to_type_ex(IS_LONG, GET_STATIC_PROP(stream), &stream_p))); + RETVAL_RESOURCE(Z_LVAL_P(convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("stream")-1, 0 TSRMLS_CC), &stream_p))); if (stream_p) { zval_ptr_dtor(&stream_p); @@ -740,14 +740,14 @@ PHP_METHOD(HttpResponse, setFile) RETURN_FALSE; } - if ( (SUCCESS != UPD_STATIC_STRL(file, the_file, file_len)) || - (SUCCESS != UPD_STATIC_PROP(long, mode, -1))) { + if ( (SUCCESS != zend_update_static_property_stringl(THIS_CE, ZEND_STRS("file")-1, the_file, file_len TSRMLS_CC)) || + (SUCCESS != zend_update_static_property_long(THIS_CE, ZEND_STRS("mode")-1, -1 TSRMLS_CC))) { RETURN_FALSE; } - UPD_STATIC_PROP(long, lastModified, http_last_modified(the_file, -1)); + zend_update_static_property_long(THIS_CE, ZEND_STRS("lastModified")-1, http_last_modified(the_file, -1) TSRMLS_CC); if ((etag = http_etag(the_file, 0, -1))) { - UPD_STATIC_PROP(string, eTag, etag); + zend_update_static_property_string(THIS_CE, ZEND_STRS("eTag")-1, etag TSRMLS_CC); efree(etag); } @@ -762,7 +762,7 @@ PHP_METHOD(HttpResponse, getFile) NO_ARGS; if (return_value_used) { - zval *the_file_p, *the_file = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(file), &the_file_p); + zval *the_file_p, *the_file = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("file")-1, 0 TSRMLS_CC), &the_file_p); RETVAL_ZVAL(the_file, 1, 0); @@ -786,7 +786,7 @@ PHP_METHOD(HttpResponse, send) HTTP_CHECK_HEADERS_SENT(RETURN_FALSE); - sent = GET_STATIC_PROP(sent); + sent = *zend_std_get_static_property(THIS_CE, ZEND_STRS("sent")-1, 0 TSRMLS_CC); if (Z_LVAL_P(sent)) { http_error(HE_WARNING, HTTP_E_RESPONSE, "Cannot send HttpResponse, response has already been sent"); RETURN_FALSE; @@ -795,18 +795,18 @@ PHP_METHOD(HttpResponse, send) } /* capture mode */ - if (zval_is_true(GET_STATIC_PROP(catch))) { + if (zval_is_true(*zend_std_get_static_property(THIS_CE, ZEND_STRS("catch")-1, 0 TSRMLS_CC))) { zval *etag_p, *the_data; MAKE_STD_ZVAL(the_data); php_ob_get_buffer(the_data TSRMLS_CC); - SET_STATIC_PROP(data, the_data); - ZVAL_LONG(GET_STATIC_PROP(mode), SEND_DATA); + zend_update_static_property(THIS_CE, ZEND_STRS("data")-1, the_data TSRMLS_CC); + ZVAL_LONG(*zend_std_get_static_property(THIS_CE, ZEND_STRS("mode")-1, 0 TSRMLS_CC), SEND_DATA); - if (!Z_STRLEN_P(convert_to_type_ex(IS_STRING, GET_STATIC_PROP(eTag), &etag_p))) { + if (!Z_STRLEN_P(convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("eTag")-1, 0 TSRMLS_CC), &etag_p))) { char *etag = http_etag(Z_STRVAL_P(the_data), Z_STRLEN_P(the_data), SEND_DATA); if (etag) { - UPD_STATIC_PROP(string, eTag, etag); + zend_update_static_property_string(THIS_CE, ZEND_STRS("eTag")-1, etag TSRMLS_CC); efree(etag); } } @@ -827,12 +827,12 @@ PHP_METHOD(HttpResponse, send) } /* caching */ - if (zval_is_true(GET_STATIC_PROP(cache))) { + if (zval_is_true(*zend_std_get_static_property(THIS_CE, ZEND_STRS("cache")-1, 0 TSRMLS_CC))) { zval *cctl, *cctl_p, *etag, *etag_p, *lmod, *lmod_p; - etag = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(eTag), &etag_p); - lmod = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(lastModified), &lmod_p); - cctl = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(cacheControl), &cctl_p); + etag = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("eTag")-1, 0 TSRMLS_CC), &etag_p); + lmod = convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("lastModified")-1, 0 TSRMLS_CC), &lmod_p); + cctl = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("cacheControl")-1, 0 TSRMLS_CC), &cctl_p); if (Z_LVAL_P(lmod) || Z_STRLEN_P(etag)) { if (Z_STRLEN_P(cctl)) { @@ -855,7 +855,7 @@ PHP_METHOD(HttpResponse, send) /* content type */ { - zval *ctype_p, *ctype = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(contentType), &ctype_p); + zval *ctype_p, *ctype = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("contentType")-1, 0 TSRMLS_CC), &ctype_p); if (Z_STRLEN_P(ctype)) { http_send_content_type(Z_STRVAL_P(ctype), Z_STRLEN_P(ctype)); } else { @@ -875,7 +875,7 @@ PHP_METHOD(HttpResponse, send) /* content disposition */ { - zval *cd_p, *cd = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(contentDisposition), &cd_p); + zval *cd_p, *cd = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("contentDisposition")-1, 0 TSRMLS_CC), &cd_p); if (Z_STRLEN_P(cd)) { http_send_header_ex("Content-Disposition", lenof("Content-Disposition"), Z_STRVAL_P(cd), Z_STRLEN_P(cd), 1, NULL); } @@ -886,8 +886,8 @@ PHP_METHOD(HttpResponse, send) /* throttling */ { - zval *bsize_p, *bsize = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(bufferSize), &bsize_p); - zval *delay_p, *delay = convert_to_type_ex(IS_DOUBLE, GET_STATIC_PROP(throttleDelay), &delay_p); + zval *bsize_p, *bsize = convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("bufferSize")-1, 0 TSRMLS_CC), &bsize_p); + zval *delay_p, *delay = convert_to_type_ex(IS_DOUBLE, *zend_std_get_static_property(THIS_CE, ZEND_STRS("throttleDelay")-1, 0 TSRMLS_CC), &delay_p); HTTP_G->send.buffer_size = Z_LVAL_P(bsize); HTTP_G->send.throttle_delay = Z_DVAL_P(delay); if (bsize_p) zval_ptr_dtor(&bsize_p); @@ -895,13 +895,13 @@ PHP_METHOD(HttpResponse, send) } /* gzip */ - HTTP_G->send.deflate.response = zval_is_true(GET_STATIC_PROP(gzip)); + HTTP_G->send.deflate.response = zval_is_true(*zend_std_get_static_property(THIS_CE, ZEND_STRS("gzip")-1, 0 TSRMLS_CC)); /* send */ - switch (Z_LVAL_P(GET_STATIC_PROP(mode))) { + switch (Z_LVAL_P(*zend_std_get_static_property(THIS_CE, ZEND_STRS("mode")-1, 0 TSRMLS_CC))) { case SEND_DATA: { - zval *zdata_p, *zdata = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(data), &zdata_p); + zval *zdata_p, *zdata = convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("data")-1, 0 TSRMLS_CC), &zdata_p); RETVAL_SUCCESS(http_send_data(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata))); if (zdata_p) zval_ptr_dtor(&zdata_p); return; @@ -910,7 +910,7 @@ PHP_METHOD(HttpResponse, send) case SEND_RSRC: { php_stream *the_real_stream; - zval *the_stream_p, *the_stream = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(stream), &the_stream_p); + zval *the_stream_p, *the_stream = convert_to_type_ex(IS_LONG, *zend_std_get_static_property(THIS_CE, ZEND_STRS("stream")-1, 0 TSRMLS_CC), &the_stream_p); the_stream->type = IS_RESOURCE; php_stream_from_zval(the_real_stream, &the_stream); RETVAL_SUCCESS(http_send_stream(the_real_stream)); @@ -921,7 +921,7 @@ PHP_METHOD(HttpResponse, send) default: { zval *file_p; - RETVAL_SUCCESS(http_send_file(Z_STRVAL_P(convert_to_type_ex(IS_STRING, GET_STATIC_PROP(file), &file_p)))); + RETVAL_SUCCESS(http_send_file(Z_STRVAL_P(convert_to_type_ex(IS_STRING, *zend_std_get_static_property(THIS_CE, ZEND_STRS("file")-1, 0 TSRMLS_CC), &file_p)))); if (file_p) zval_ptr_dtor(&file_p); return; } @@ -938,7 +938,7 @@ PHP_METHOD(HttpResponse, capture) HTTP_CHECK_HEADERS_SENT(RETURN_FALSE); - UPD_STATIC_PROP(long, catch, 1); + zend_update_static_property_long(THIS_CE, ZEND_STRS("catch")-1, 1 TSRMLS_CC); php_end_ob_buffers(0 TSRMLS_CC); php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC); diff --git a/package2.xml b/package2.xml index a968cb0..3d1e80a 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-02-21 + 2007-02-22 - 1.5.1 + 1.5.2 1.5.0 @@ -39,7 +39,7 @@ support. Parallel requests are available for PHP 5 and greater. BSD, revised diff --git a/php_http.h b/php_http.h index 089e365..2ca0d2f 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.5.1" +#define PHP_EXT_HTTP_VERSION "1.5.2" #ifdef HAVE_CONFIG_H # include "config.h" diff --git a/php_http_std_defs.h b/php_http_std_defs.h index bf16328..792ddda 100644 --- a/php_http_std_defs.h +++ b/php_http_std_defs.h @@ -83,12 +83,12 @@ typedef int STATUS; #define RETURN_PROP(n) RETURN_PROP_EX(getThis(), n) #define RETVAL_PROP_EX(this, n) \ { \ - zval *__prop = GET_PROP_EX(this, n); \ + zval *__prop = zend_read_property(THIS_CE, this, ZEND_STRS(#n)-1, 0 TSRMLS_CC); \ RETVAL_ZVAL(__prop, 1, 0); \ } #define RETURN_PROP_EX(this, n) \ { \ - zval *__prop = GET_PROP_EX(this, n); \ + zval *__prop = zend_read_property(THIS_CE, this, ZEND_STRS(#n)-1, 0 TSRMLS_CC); \ RETURN_ZVAL(__prop, 1, 0); \ } @@ -201,31 +201,6 @@ typedef int STATUS; # define OBJ_PROP(o) (o)->zo.properties # define OBJ_GUARDS(o) (o)->zo.guards -# define DCL_STATIC_PROP(a, t, n, v) zend_declare_property_ ##t(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC) -# define DCL_STATIC_PROP_Z(a, n, v) zend_declare_property(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC) -# define DCL_STATIC_PROP_N(a, n) zend_declare_property_null(OBJ_PROP_CE, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a | ZEND_ACC_STATIC) TSRMLS_CC) -# define GET_STATIC_PROP_EX(ce, n) zend_std_get_static_property(ce, (#n), sizeof(#n)-1, 0 TSRMLS_CC) -# define UPD_STATIC_PROP_EX(ce, t, n, v) zend_update_static_property_ ##t(ce, #n, sizeof(#n)-1, (v) TSRMLS_CC) -# define UPD_STATIC_STRL_EX(ce, n, v, l) zend_update_static_property_stringl(ce, #n, sizeof(#n)-1, (v), (l) TSRMLS_CC) -# define SET_STATIC_PROP_EX(ce, n, v) zend_update_static_property(ce, #n, sizeof(#n)-1, v TSRMLS_CC) -# define GET_STATIC_PROP(n) *GET_STATIC_PROP_EX(OBJ_PROP_CE, n) -# define UPD_STATIC_PROP(t, n, v) UPD_STATIC_PROP_EX(OBJ_PROP_CE, t, n, v) -# define SET_STATIC_PROP(n, v) SET_STATIC_PROP_EX(OBJ_PROP_CE, n, v) -# define UPD_STATIC_STRL(n, v, l) UPD_STATIC_STRL_EX(OBJ_PROP_CE, n, v, l) - -# define DCL_PROP(a, t, n, v) zend_declare_property_ ##t(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC) -# define DCL_PROP_Z(a, n, v) zend_declare_property(OBJ_PROP_CE, (#n), sizeof(#n)-1, (v), (ZEND_ACC_ ##a) TSRMLS_CC) -# define DCL_PROP_N(a, n) zend_declare_property_null(OBJ_PROP_CE, (#n), sizeof(#n)-1, (ZEND_ACC_ ##a) TSRMLS_CC) -# define UPD_PROP(t, n, v) UPD_PROP_EX(getThis(), t, n, v) -# define UPD_PROP_EX(this, t, n, v) zend_update_property_ ##t(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, (v) TSRMLS_CC) -# define UPD_STRL(n, v, l) zend_update_property_stringl(OBJ_PROP_CE, getThis(), (#n), sizeof(#n)-1, (v), (l) TSRMLS_CC) -# define SET_PROP(n, z) SET_PROP_EX(getThis(), n, z) -# define SET_PROP_EX(this, n, z) zend_update_property(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, (z) TSRMLS_CC) -# define GET_PROP(n) GET_PROP_EX(getThis(), n) -# define GET_PROP_EX(this, n) zend_read_property(OBJ_PROP_CE, this, (#n), sizeof(#n)-1, 0 TSRMLS_CC) - -# define DCL_CONST(t, n, v) zend_declare_class_constant_ ##t(OBJ_PROP_CE, (n), sizeof(n)-1, (v) TSRMLS_CC) - # define ACC_PROP_PRIVATE(ce, flags) ((flags & ZEND_ACC_PRIVATE) && (EG(scope) && ce == EG(scope)) # define ACC_PROP_PROTECTED(ce, flags) ((flags & ZEND_ACC_PROTECTED) && (zend_check_protected(ce, EG(scope)))) # define ACC_PROP_PUBLIC(flags) (flags & ZEND_ACC_PUBLIC) -- 2.30.2