RETVAL_ZVAL(getThis(), 1, 0);
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_count, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpClient_count, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, count)
{
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpHeader, __serialize)
+{
+ zval name, value, *ptr;
+
+ zend_parse_parameters_none();
+
+ array_init(return_value);
+ ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name);
+ Z_TRY_ADDREF_P(ptr);
+ add_next_index_zval(return_value, ptr);
+ ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value);
+ Z_TRY_ADDREF_P(ptr);
+ add_next_index_zval(return_value, ptr);
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___unserialize, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpHeader, __unserialize)
+{
+ HashTable *ha;
+ zval *name, *value;
+
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &ha), invalid_arg, return);
+ name = zend_hash_index_find(ha, 0);
+ value = zend_hash_index_find(ha, 1);
+
+ if (name && value) {
+ zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), name);
+ zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value);
+ }
+}
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_serialize, 0, 0, 0)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, serialize)
static zend_function_entry php_http_header_methods[] = {
PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, __unserialize, ai_HttpHeader___unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, __serialize, ai_HttpHeader___serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
- PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, match, ai_HttpHeader_match, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, negotiate, ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, getParams, ai_HttpHeader_getParams, ZEND_ACC_PUBLIC)
}
}
static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value) {
- if (obj->body) {
- zval tmp;
+ zval tmp;
- ZVAL_COPY_VALUE(&tmp, return_value);
- RETVAL_OBJECT(&obj->body->zo, 1);
- zval_ptr_dtor(&tmp);
- } else {
- RETVAL_NULL();
+ if (!obj->body) {
+ RETURN_NULL();
}
+
+ ZVAL_COPY_VALUE(&tmp, return_value);
+ RETVAL_OBJECT(&obj->body->zo, 1);
+ zval_ptr_dtor(&tmp);
}
static void php_http_message_object_prophandler_set_body(php_http_message_object_t *obj, zval *value) {
php_http_message_object_set_body(obj, value);
static HashTable *php_http_message_object_get_debug_info(zend_object *object, int *is_temp)
{
- zval tmp;
php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL);
HashTable *props = zend_get_std_object_handlers()->get_properties(object);
char *ver_str, *url_str = NULL;
size_t ver_len, url_len = 0;
+ zval tmp;
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
- *is_temp = 0;
+ if (is_temp) {
+ *is_temp = 0;
+ }
#define UPDATE_PROP(name_str, action_with_tmp) \
do { \
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, __serialize)
+{
+ zend_ulong num_index;
+ zend_string *str_index;
+ zend_property_info *pi;
+ php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+ HashTable *props = php_http_message_object_get_debug_info(&obj->zo, NULL);
+
+ zend_parse_parameters_none();
+
+ array_init(return_value);
+
+ ZEND_HASH_FOREACH_KEY_PTR(&obj->zo.ce->properties_info, num_index, str_index, pi)
+ {
+ zval *val;
+ if (str_index && (val = zend_hash_find_ind(props, pi->name))) {
+ Z_TRY_ADDREF_P(val);
+ zend_hash_update(Z_ARRVAL_P(return_value), str_index, val);
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___unserialize, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, __unserialize)
+{
+ HashTable *arr;
+ zend_string *key;
+ zval *val;
+ php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr), invalid_arg, return);
+
+ PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
+
+ ZEND_HASH_FOREACH_STR_KEY_VAL(arr, key, val)
+ {
+ php_http_message_object_prophandler_t *ph = php_http_message_object_get_prophandler(key);
+ if (ph) {
+ ph->write(obj, val);
+ } else {
+ zend_update_property_ex(php_http_message_class_entry, &obj->zo, key, val);
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+}
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, serialize)
RETURN_OBJ(&php_http_message_object_new_ex(obj->zo.ce, msg)->zo);
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_count, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, count)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_rewind, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_rewind, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, rewind)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_valid, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_valid, 0, 0, _IS_BOOL, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, valid)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_next, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_next, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, next)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_key, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage_key, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, key)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_current, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpMessage_current, 0, 0, http\\Message, 0)
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpMessage, current)
{
/* implements Serializable */
PHP_ME(HttpMessage, serialize, ai_HttpMessage_serialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessage, unserialize, ai_HttpMessage_unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, __serialize, ai_HttpMessage___serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, __unserialize, ai_HttpMessage___unserialize, ZEND_ACC_PUBLIC)
/* implements Iterator */
PHP_ME(HttpMessage, rewind, ai_HttpMessage_rewind, ZEND_ACC_PUBLIC)
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___unserialize, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpMessageBody, __unserialize)
+{
+ HashTable *arr;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr)) {
+ zval *zv = zend_hash_index_find(arr, 0);
+
+ if (0 && zv) {
+ zend_string *zs = zval_get_string(zv);
+ php_stream *s = php_http_mem_stream_open(0, zs);
+ php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+
+ obj->body = php_http_message_body_init(NULL, s);
+ php_stream_to_zval(s, obj->gc);
+ zend_string_release(zs);
+ }
+ }
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpMessageBody, __serialize)
+{
+
+ php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+ zend_string *zs;
+
+ zend_parse_parameters_none();
+
+ PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
+
+ array_init(return_value);
+ zs = php_http_message_body_to_string(obj->body, 0, 0);
+ if (zs) {
+ add_index_str(return_value, 0, zs);
+ zend_string_release(zs);
+ }
+}
+
+
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_toStream, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_ARG_INFO(0, offset)
PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, unserialize, ai_HttpMessageBody_unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, __serialize, ai_HttpMessageBody___serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, __unserialize,ai_HttpMessageBody___unserialize,ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, toStream, ai_HttpMessageBody_toStream, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, toCallback, ai_HttpMessageBody_toCallback, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, getResource, ai_HttpMessageBody_getResource, ZEND_ACC_PUBLIC)
RETVAL_STR(php_http_cs2zs(buf.data, buf.used));
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetExists, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetExists, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetExists)
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetGet, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetGet, 0, 1, IS_MIXED, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetGet)
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetUnset, 0, 0, 1)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetUnset, 0, 1, IS_VOID, 0)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetUnset)
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetSet, 0, 0, 2)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetSet, 0, 2, IS_VOID, 0)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, Traversable, 0)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, getIterator)
{
}
#endif /* HAVE_ICONV */
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___serialize, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpQueryString, __serialize)
+{
+ zval *zqa, zqa_tmp;
+
+ zend_parse_parameters_none();
+
+ zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp);
+ RETURN_ZVAL(zqa, 1, 0);
+}
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___unserialize, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO();
+PHP_METHOD(HttpQueryString, __unserialize)
+{
+ zval *qa;
+
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a", &qa), invalid_arg, return);
+ php_http_querystring_set(getThis(), qa, 0);
+}
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_serialize, 0, 0, 0)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, serialize)
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetGet, 0, 1, IS_MIXED, 1)
+ ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetGet)
{
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetSet, 0, 2, IS_VOID, 0)
+ ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetSet)
zval_ptr_dtor(¶m);
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetExists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetExists)
{
RETURN_FALSE;
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetUnset)
{
/* Implements Serializable */
PHP_ME(HttpQueryString, serialize, ai_HttpQueryString_serialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpQueryString, unserialize, ai_HttpQueryString_unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, __serialize, ai_HttpQueryString___serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, __unserialize, ai_HttpQueryString___unserialize, ZEND_ACC_PUBLIC)
/* Implements ArrayAccess */
PHP_ME(HttpQueryString, offsetGet, ai_HttpQueryString_offsetGet, ZEND_ACC_PUBLIC)