From bb9aedc2855f63da858d3c92e2863e7d9ed72a77 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 20 Sep 2005 08:58:02 +0000 Subject: [PATCH] - ensure proper CURL_EXTERN macro by defining CURL_STATICLIB - no request methods class constants for WONKY - no zend_get_property_info() in WONKY --- config.w32 | 1 + http_message_object.c | 34 ++++++++++++++++++++++++++-------- http_request_method_api.c | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/config.w32 b/config.w32 index 0c5d6f0..23a2dd1 100644 --- a/config.w32 +++ b/config.w32 @@ -40,6 +40,7 @@ if (PHP_HTTP != "no") { AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, ""); AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, ""); AC_DEFINE("HAVE_CURL_EASY_RESET", 1, ""); + AC_DEFINE("CURL_STATICLIB", 1, ""); } else { WARNING("curl convenience functions not enabled; libraries and headers not found"); } diff --git a/http_message_object.c b/http_message_object.c index 88ab7d4..e3a1617 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -231,21 +231,25 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type getObjectEx(http_message_object, obj, object); http_message *msg = obj->message; zval *return_value; +#ifdef WONKY + zend_hash_value h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member)+1); +#else zend_property_info *pinfo = zend_get_property_info(obj->zo.ce, member, 1 TSRMLS_CC); if (!pinfo || ACC_PROP_PUBLIC(pinfo->flags)) { return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); } +#endif return_value = &EG(uninitialized_zval); return_value->refcount = 0; return_value->is_ref = 0; -#if 0 - fprintf(stderr, "Read HttpMessage::$%s\n", Z_STRVAL_P(member)); -#endif - +#ifdef WONKY + switch (h) +#else switch (pinfo->h) +#endif { case HTTP_MSG_PROPHASH_TYPE: RETVAL_LONG(msg->type); @@ -316,7 +320,11 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type break; default: +#ifdef WONKY + return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); +#else RETVAL_NULL(); +#endif break; } @@ -327,18 +335,22 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va { getObjectEx(http_message_object, obj, object); http_message *msg = obj->message; +#ifdef WONKY + zend_hash_value h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); +#else zend_property_info *pinfo = zend_get_property_info(obj->zo.ce, member, 1 TSRMLS_CC); if (!pinfo || ACC_PROP_PUBLIC(pinfo->flags)) { zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC); return; } - -#if 0 - fprintf(stderr, "Write HttpMessage::$%s\n", Z_STRVAL_P(member)); #endif +#ifdef WONKY + switch (h) +#else switch (pinfo->h) +#endif { case HTTP_MSG_PROPHASH_TYPE: convert_to_long_ex(&value); @@ -398,7 +410,13 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va convert_to_string_ex(&value); STR_SET(msg->http.info.response.status, estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value))); } - + break; + + default: +#ifdef WONKY + zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC); +#endif + break; } } diff --git a/http_request_method_api.c b/http_request_method_api.c index 28365f7..8c18129 100644 --- a/http_request_method_api.c +++ b/http_request_method_api.c @@ -174,7 +174,7 @@ PHP_HTTP_API unsigned long _http_request_method_register(const char *method_name zend_register_long_constant(http_method, method_len + 1, meth_num, CONST_CS, http_module_number TSRMLS_CC); efree(http_method); -#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) && !defined(WONKY) method_len = spprintf(&http_method, 0, "METH_%s", method); zend_declare_class_constant_long(http_request_object_ce, http_method, method_len, meth_num TSRMLS_CC); efree(http_method); @@ -196,7 +196,7 @@ PHP_HTTP_API STATUS _http_request_method_unregister(unsigned long method TSRMLS_ return FAILURE; } -#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) +#if defined(ZEND_ENGINE_2) && defined(HTTP_HAVE_CURL) && !defined(WONKY) method_len = spprintf(&http_method, 0, "METH_%s", Z_STRVAL_PP(zmethod)); if ((SUCCESS != zend_hash_del(&http_request_object_ce->constants_table, http_method, method_len + 1))) { http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Could not unregister request method: HttpRequest::%s", http_method); -- 2.30.2