From: Michael Wallner Date: Mon, 27 Jul 2009 14:04:55 +0000 (+0000) Subject: fix PHP5.1 build X-Git-Tag: RELEASE_1_6_5~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d9d2df7ab6c6c3453f25187903b514c9e9515de9;p=m6w6%2Fext-http fix PHP5.1 build fix access of HttpMessage properties across 5.x branches --- diff --git a/http_message_object.c b/http_message_object.c index 121337b..49b76e0 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -414,11 +414,15 @@ void _http_message_object_free(zend_object *object TSRMLS_DC) freeObject(o); } -static zval **_http_message_object_get_prop_ptr(zval *object, zval *member TSRMLS_DC) { - getObjectEx(http_message_object, obj, object); - zend_property_info *pinfo = zend_get_property_info(obj->zo.ce, member, 1 TSRMLS_CC); - - if (!pinfo || pinfo->ce != http_message_object_ce) { +static zval **_http_message_object_get_prop_ptr(zval *object, zval *member TSRMLS_DC) +{ + int member_len = Z_STRLEN_P(member); + +#ifndef WONKY + member_len += 1; +#endif + + if (!zend_hash_exists(&http_message_object_ce->properties_info, Z_STRVAL_P(member), member_len)) { return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member TSRMLS_CC); } zend_error(E_ERROR, "Cannot access HttpMessage properties by reference or array key/index"); @@ -430,17 +434,16 @@ 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 - ulong h = zend_hash_func(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 || pinfo->ce != http_message_object_ce) { - return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); - } + int member_len = Z_STRLEN_P(member); + +#ifndef WONKY + member_len += 1; #endif - if (type == BP_VAR_W) { + if (!zend_hash_exists(&http_message_object_ce->properties_info, Z_STRVAL_P(member), member_len)) { + return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); + } + if (type != BP_VAR_R) { zend_error(E_ERROR, "Cannot access HttpMessage properties by reference or array key/index"); return NULL; } @@ -454,11 +457,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type return_value->is_ref = 0; #endif -#ifdef WONKY - switch (h) -#else - switch (pinfo->h) -#endif + switch (zend_hash_func(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1)) { case HTTP_MSG_PROPHASH_TYPE: case HTTP_MSG_CHILD_PROPHASH_TYPE: @@ -529,6 +528,7 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type default: FREE_ZVAL(return_value); + zend_error(E_WARNING, "possible bug accessing HttpMessage property"); return zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); } @@ -540,22 +540,18 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va getObjectEx(http_message_object, obj, object); http_message *msg = obj->message; zval *cpy = NULL; -#ifdef WONKY - ulong h = zend_hash_func(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 || pinfo->ce != http_message_object_ce) { + int member_len = Z_STRLEN_P(member); + +#ifndef WONKY + member_len += 1; +#endif + + if (!zend_hash_exists(&http_message_object_ce->properties_info, Z_STRVAL_P(member), member_len)) { zend_get_std_object_handlers()->write_property(object, member, value TSRMLS_CC); return; } -#endif -#ifdef WONKY - switch (h) -#else - switch (pinfo->h) -#endif + switch (zend_hash_func(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1)) { case HTTP_MSG_PROPHASH_TYPE: case HTTP_MSG_CHILD_PROPHASH_TYPE: diff --git a/package2.xml b/package2.xml index 36b8a8b..fa3c600 100644 --- a/package2.xml +++ b/package2.xml @@ -30,7 +30,7 @@ support. Parallel requests are available for PHP 5 and greater. 2009-07-24 - 1.6.4 + 1.6.5-dev 1.6.0 @@ -39,12 +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 5ff1488..bc149a6 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_HTTP_VERSION "1.6.4" +#define PHP_HTTP_VERSION "1.6.5-dev" #ifdef HAVE_CONFIG_H # include "config.h"