} else {
zend_string *tmp = zval_get_string(zdata);
- stream = php_stream_memory_open(TEMP_STREAM_READONLY, tmp->val, tmp->len);
+ stream = php_http_mem_stream_open(TEMP_STREAM_READONLY, tmp);
zend_string_release(tmp);
}
} else {
ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, unserialize)
{
- char *us_str;
- size_t us_len;
+ zend_string *us_str;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &us_str, &us_len)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &us_str)) {
php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
- php_stream *s = php_stream_memory_open(0, us_str, us_len);
+ php_stream *s = php_http_mem_stream_open(0, us_str);
obj->body = php_http_message_body_init(NULL, s);
php_stream_to_zval(s, obj->gc);
# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL))))
#endif
+#if PHP_VERSION_ID >= 80100
+# define php_http_mem_stream_open(type, zstr) php_stream_memory_open((type), (zstr))
+#else
+# define php_http_mem_stream_open(type, zstr) php_stream_memory_open((type), (zstr)->val, (zstr)->len)
+#endif
#define HT_IS_RECURSIVE(ht) GC_IS_RECURSIVE(ht)
#define HT_PROTECT_RECURSION(ht) GC_PROTECT_RECURSION(ht)