projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
provide RTLD_LAZY compatibility
[m6w6/ext-http]
/
php_http_message.c
diff --git
a/php_http_message.c
b/php_http_message.c
index 3d3822cfeeb8326e455e5aae29d8d1afa93e8b38..a6b30f5ca9b2c9f57474a544435c702d6496ead0 100644
(file)
--- a/
php_http_message.c
+++ b/
php_http_message.c
@@
-496,7
+496,6
@@
void php_http_message_free(php_http_message_t **message)
static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv);
static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv);
static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot);
-static HashTable *php_http_message_object_get_props(zval *object);
static zend_object_handlers php_http_message_object_handlers;
static HashTable php_http_message_object_prophandlers;
static zend_object_handlers php_http_message_object_handlers;
static HashTable php_http_message_object_prophandlers;
@@
-690,11
+689,12
@@
void php_http_message_object_reverse(zval *zmsg, zval *return_value)
/* add ref, because we previously have not been a parent message */
Z_ADDREF_P(zmsg);
/* add ref, because we previously have not been a parent message */
Z_ADDREF_P(zmsg);
- RETVAL_OBJECT(&objects[last]->zo, 1);
+ /* no addref, because we've been a parent message previously */
+ RETVAL_OBJECT(&objects[last]->zo, 0);
efree(objects);
} else {
efree(objects);
} else {
- RETURN_ZVAL
_FAST(zmsg
);
+ RETURN_ZVAL
(zmsg, 1, 0
);
}
}
}
}
@@
-776,10
+776,11
@@
ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg
}
if (msg_obj->message) {
php_http_message_body_free(&msg_obj->message->body);
}
if (msg_obj->message) {
php_http_message_body_free(&msg_obj->message->body);
- msg_obj->message->body =
php_http_message_body_init(&body_obj->body, NULL)
;
+ msg_obj->message->body =
body_obj->body
;
} else {
} else {
- msg_obj->message = php_http_message_init(NULL, 0,
php_http_message_body_init(&body_obj->body, NULL)
);
+ msg_obj->message = php_http_message_init(NULL, 0,
body_obj->body
);
}
}
+ php_http_message_body_addref(body_obj->body);
msg_obj->body = body_obj;
return SUCCESS;
msg_obj->body = body_obj;
return SUCCESS;
@@
-843,10
+844,16
@@
void php_http_message_object_free(zend_object *object)
o->message = NULL;
}
if (o->parent) {
o->message = NULL;
}
if (o->parent) {
+ if (GC_REFCOUNT(&o->parent->zo) == 1) {
+ zend_objects_store_del(&o->parent->zo);
+ }
zend_objects_store_del(&o->parent->zo);
o->parent = NULL;
}
if (o->body) {
zend_objects_store_del(&o->parent->zo);
o->parent = NULL;
}
if (o->body) {
+ if (GC_REFCOUNT(&o->body->zo) == 1) {
+ zend_objects_store_del(&o->body->zo);
+ }
zend_objects_store_del(&o->body->zo);
o->body = NULL;
}
zend_objects_store_del(&o->body->zo);
o->body = NULL;
}
@@
-872,7
+879,14
@@
static zval *php_http_message_object_read_prop(zval *object, zval *member, int t
ZVAL_COPY_VALUE(return_value, tmp);
}
} else {
ZVAL_COPY_VALUE(return_value, tmp);
}
} else {
- return_value = php_property_proxy_zval(object, member_name);
+ php_property_proxy_t *proxy;
+ php_property_proxy_object_t *proxy_obj;
+
+ proxy = php_property_proxy_init(object, member_name);
+ proxy_obj = php_property_proxy_object_new_ex(NULL, proxy);
+
+ ZVAL_OBJ(tmp, &proxy_obj->zo);
+ return tmp;
}
zend_string_release(member_name);
}
zend_string_release(member_name);
@@
-897,7
+911,7
@@
static void php_http_message_object_write_prop(zval *object, zval *member, zval
zend_string_release(member_name);
}
zend_string_release(member_name);
}
-static HashTable *php_http_message_object_get_
props(zval *object
)
+static HashTable *php_http_message_object_get_
debug_info(zval *object, int *is_temp
)
{
zval tmp;
php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
{
zval tmp;
php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
@@
-906,13
+920,14
@@
static HashTable *php_http_message_object_get_props(zval *object)
size_t ver_len, url_len = 0;
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
size_t ver_len, url_len = 0;
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
+ *is_temp = 0;
#define UPDATE_PROP(name_str, action_with_tmp) \
do { \
zend_property_info *pi; \
if ((pi = zend_hash_str_find_ptr(&obj->zo.ce->properties_info, name_str, lenof(name_str)))) { \
action_with_tmp; \
#define UPDATE_PROP(name_str, action_with_tmp) \
do { \
zend_property_info *pi; \
if ((pi = zend_hash_str_find_ptr(&obj->zo.ce->properties_info, name_str, lenof(name_str)))) { \
action_with_tmp; \
- zend_hash_update(props, pi->name, &tmp); \
+ zend_hash_update
_ind
(props, pi->name, &tmp); \
} \
} while(0)
} \
} while(0)
@@
-1071,7
+1086,7
@@
static PHP_METHOD(HttpMessage, setBody)
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
php_http_message_object_prophandler_set_body(obj, zbody);
}
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
php_http_message_object_prophandler_set_body(obj, zbody);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
@@
-1088,7
+1103,7
@@
static PHP_METHOD(HttpMessage, addBody)
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
php_http_message_body_to_callback(new_obj->body, (php_http_pass_callback_t) php_http_message_body_append, obj->message->body, 0, 0);
}
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
php_http_message_body_to_callback(new_obj->body, (php_http_pass_callback_t) php_http_message_body_append, obj->message->body, 0, 0);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeader, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeader, 0, 0, 1)
@@
-1109,7
+1124,7
@@
static PHP_METHOD(HttpMessage, getHeader)
if ((header = php_http_message_header(obj->message, header_str, header_len))) {
if (!header_ce) {
if ((header = php_http_message_header(obj->message, header_str, header_len))) {
if (!header_ce) {
- RETURN_ZVAL
_FAST(header
);
+ RETURN_ZVAL
(header, 1, 0
);
} else if (instanceof_function(header_ce, php_http_header_class_entry)) {
php_http_object_method_t cb;
zval argv[2];
} else if (instanceof_function(header_ce, php_http_header_class_entry)) {
php_http_object_method_t cb;
zval argv[2];
@@
-1172,7
+1187,7
@@
static PHP_METHOD(HttpMessage, setHeader)
}
efree(name);
}
}
efree(name);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
@@
-1192,7
+1207,7
@@
static PHP_METHOD(HttpMessage, setHeaders)
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, 0, ARRAY_JOIN_PRETTIFY|ARRAY_JOIN_STRONLY);
}
}
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, 0, ARRAY_JOIN_PRETTIFY|ARRAY_JOIN_STRONLY);
}
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeader, 0, 0, 2)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeader, 0, 0, 2)
@@
-1221,7
+1236,7
@@
static PHP_METHOD(HttpMessage, addHeader)
}
efree(name);
}
}
efree(name);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
@@
-1240,7
+1255,7
@@
static PHP_METHOD(HttpMessage, addHeaders)
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
}
array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getType, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getType, 0, 0, 0)
@@
-1270,7
+1285,7
@@
static PHP_METHOD(HttpMessage, setType)
php_http_message_set_type(obj->message, type);
}
php_http_message_set_type(obj->message, type);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getInfo, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getInfo, 0, 0, 0)
@@
-1325,7
+1340,7
@@
static PHP_METHOD(HttpMessage, setInfo)
php_http_message_set_info(obj->message, &inf);
php_http_info_dtor(&inf);
php_http_message_set_info(obj->message, &inf);
php_http_info_dtor(&inf);
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHttpVersion, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHttpVersion, 0, 0, 0)
@@
-1363,7
+1378,7
@@
static PHP_METHOD(HttpMessage, setHttpVersion)
obj->message->http.version = version;
obj->message->http.version = version;
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseCode, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseCode, 0, 0, 0)
@@
-1412,7
+1427,7
@@
static PHP_METHOD(HttpMessage, setResponseCode)
obj->message->http.info.response.code = code;
PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(code)));
obj->message->http.info.response.code = code;
PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(code)));
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseStatus, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseStatus, 0, 0, 0)
@@
-1456,7
+1471,7
@@
static PHP_METHOD(HttpMessage, setResponseStatus)
}
PTR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
}
PTR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestMethod, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestMethod, 0, 0, 0)
@@
-1507,7
+1522,7
@@
static PHP_METHOD(HttpMessage, setRequestMethod)
}
PTR_SET(obj->message->http.info.request.method, estrndup(method, method_len));
}
PTR_SET(obj->message->http.info.request.method, estrndup(method, method_len));
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestUrl, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestUrl, 0, 0, 0)
@@
-1568,7
+1583,7
@@
static PHP_METHOD(HttpMessage, setRequestUrl)
PTR_SET(obj->message->http.info.request.url, url);
}
PTR_SET(obj->message->http.info.request.url, url);
}
- RETVAL_ZVAL
_FAST(getThis()
);
+ RETVAL_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getParentMessage, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getParentMessage, 0, 0, 0)
@@
-1653,7
+1668,7
@@
static PHP_METHOD(HttpMessage, toCallback)
zend_fcall_info_args_clear(&fcd.fci, 1);
zval_ptr_dtor(&fcd.fcz);
zend_fcall_info_args_clear(&fcd.fci, 1);
zval_ptr_dtor(&fcd.fcz);
- RETURN_ZVAL
_FAST(getThis()
);
+ RETURN_ZVAL
(getThis(), 1, 0
);
}
}
}
}
@@
-1747,7
+1762,7
@@
static PHP_METHOD(HttpMessage, prepend)
}
php_http_message_object_prepend(getThis(), prepend, top);
}
php_http_message_object_prepend(getThis(), prepend, top);
- RETURN_ZVAL
_FAST(getThis()
);
+ RETURN_ZVAL
(getThis(), 1, 0
);
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_reverse, 0, 0, 0)
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_reverse, 0, 0, 0)
@@
-1895,7
+1910,7
@@
static PHP_METHOD(HttpMessage, current)
php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
if (!Z_ISUNDEF(obj->iterator)) {
php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
if (!Z_ISUNDEF(obj->iterator)) {
- RETURN_ZVAL
_FAST(&obj->iterator
);
+ RETURN_ZVAL
(&obj->iterator, 1, 0
);
}
}
}
}
}
}
@@
-1971,7
+1986,7
@@
PHP_MINIT_FUNCTION(http_message)
php_http_message_object_handlers.free_obj = php_http_message_object_free;
php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
php_http_message_object_handlers.free_obj = php_http_message_object_free;
php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
- php_http_message_object_handlers.get_
properties = php_http_message_object_get_props
;
+ php_http_message_object_handlers.get_
debug_info = php_http_message_object_get_debug_info
;
php_http_message_object_handlers.get_property_ptr_ptr = NULL;
zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
php_http_message_object_handlers.get_property_ptr_ptr = NULL;
zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);