PHP_HTTP_END_ARGS;
PHP_HTTP_EMPTY_ARGS(__toString);
+PHP_HTTP_BEGIN_ARGS(unserialize, 1)
+ PHP_HTTP_ARG_VAL(serialized, 0)
+PHP_HTTP_END_ARGS;
PHP_HTTP_BEGIN_ARGS(toStream, 1)
PHP_HTTP_ARG_VAL(stream, 0)
PHP_HTTP_MESSAGE_BODY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_HTTP_MESSAGE_BODY_ME(__toString, ZEND_ACC_PUBLIC)
PHP_MALIAS(HttpMessageBody, toString, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, serialize, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_HTTP_MESSAGE_BODY_ME(unserialize, ZEND_ACC_PUBLIC)
PHP_HTTP_MESSAGE_BODY_ME(toStream, ZEND_ACC_PUBLIC)
PHP_HTTP_MESSAGE_BODY_ME(toCallback, ZEND_ACC_PUBLIC)
PHP_HTTP_MESSAGE_BODY_ME(getResource, ZEND_ACC_PUBLIC)
php_http_message_body_class_entry->create_object = php_http_message_body_object_new;
memcpy(&php_http_message_body_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_message_body_object_handlers.clone_obj = php_http_message_body_object_clone;
-
+ zend_class_implements(php_http_message_body_class_entry TSRMLS_CC, 1, zend_ce_serializable);
return SUCCESS;
}
RETURN_EMPTY_STRING();
}
+PHP_METHOD(HttpMessageBody, unserialize)
+{
+ char *us_str;
+ int us_len;
+
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &us_str, &us_len)) {
+ php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+ php_stream *s = php_stream_memory_open(0, us_str, us_len);
+
+ obj->body = php_http_message_body_init(NULL, s TSRMLS_CC);
+ }
+}
+
PHP_METHOD(HttpMessageBody, toStream)
{
zval *zstream;