flush WIP
authorMichael Wallner <mike@php.net>
Wed, 14 Jan 2015 20:53:09 +0000 (21:53 +0100)
committerMichael Wallner <mike@php.net>
Wed, 14 Jan 2015 20:53:09 +0000 (21:53 +0100)
50 files changed:
package.xml
php_http.c
php_http.h
php_http_api.h
php_http_buffer.c
php_http_buffer.h
php_http_client.c
php_http_client.h
php_http_client_curl.c
php_http_cookie.c
php_http_cookie.h
php_http_encoding.c
php_http_encoding.h
php_http_env.c
php_http_env.h
php_http_env_response.c
php_http_env_response.h
php_http_etag.c
php_http_etag.h
php_http_exception.c
php_http_exception.h
php_http_filter.c
php_http_header.c
php_http_header.h
php_http_header_parser.c
php_http_header_parser.h
php_http_info.c
php_http_info.h
php_http_message.c
php_http_message.h
php_http_message_body.c
php_http_message_body.h
php_http_message_parser.c
php_http_message_parser.h
php_http_misc.c
php_http_misc.h
php_http_negotiate.c
php_http_negotiate.h
php_http_object.c
php_http_object.h
php_http_options.c
php_http_options.h
php_http_params.h
php_http_querystring.c
php_http_querystring.h
php_http_strlist.c
php_http_url.c
php_http_url.h
php_http_version.c
php_http_version.h

index 56bce0c17f10692ffd937c0305654eb37515417e..726d2c2a740c7dda83183c00501e663eece77b28 100644 (file)
@@ -22,13 +22,7 @@ arbitrary data with caching and resuming capabilities.
 It provides powerful request functionality with support for
 parallel requests.
 
 It provides powerful request functionality with support for
 parallel requests.
 
-Documentation:
-v1: http://php.net/http
-v2: http://devel-m6w6.rhcloud.com/mdref/http
-
-Code Coverage:
-v1: http://dev.iworks.at/ext-http/lcov_html/ext/http/
-v2: http://dev.iworks.at/ext-http/lcov/ext/http/
+http://devel-m6w6.rhcloud.com/mdref/http
 
 ]]></description>
  <lead>
 
 ]]></description>
  <lead>
@@ -37,10 +31,10 @@ v2: http://dev.iworks.at/ext-http/lcov/ext/http/
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2014-11-12</date>
+ <date>2014-12-17</date>
  <version>
  <version>
-  <release>2.2.0dev</release>
-  <api>2.2.0</api>
+  <release>3.0.0dev</release>
+  <api>3.0.0</api>
  </version>
  <stability>
   <release>beta</release>
  </version>
  <stability>
   <release>beta</release>
@@ -48,12 +42,7 @@ v2: http://dev.iworks.at/ext-http/lcov/ext/http/
  </stability>
  <license>BSD, revised</license>
  <notes><![CDATA[
  </stability>
  <license>BSD, revised</license>
  <notes><![CDATA[
-- var_dump(http\Message) no longer automatically creates an empty body
-+ Added http\Message\Parser class
-+ Made http\Client::once() and http\Client::wait() available when using events
-+ Added http\Url::PARSE_MBLOC, http\Url::PARSE_MBUTF8, http\Url::PARSE_TOIDN and http\Url::PARSE_TOPCT constants
-+ Added http\Env\Response::setCookie()
-+ Added http\Env\Request::getCookie()
+*
 ]]></notes>
  <contents>
   <dir name="/">
 ]]></notes>
  <contents>
   <dir name="/">
index f7a0b8698f03012f2d8460532fcdb37504ea5649..0bf09ac775a44c39584e5ef5faae926a67c31ece 100644 (file)
@@ -117,14 +117,6 @@ static inline void php_http_globals_free(zend_php_http_globals *G TSRMLS_DC)
 }
 #endif
 
 }
 #endif
 
-#if ZTS && PHP_DEBUG && !HAVE_GCOV
-zend_php_http_globals *php_http_globals(void)
-{
-       TSRMLS_FETCH();
-       return PHP_HTTP_G;
-}
-#endif
-
 PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("http.etag.mode", "crc32b", PHP_INI_ALL, OnUpdateString, env.etag_mode, zend_php_http_globals, php_http_globals)
 PHP_INI_END()
 PHP_INI_BEGIN()
        STD_PHP_INI_ENTRY("http.etag.mode", "crc32b", PHP_INI_ALL, OnUpdateString, env.etag_mode, zend_php_http_globals, php_http_globals)
 PHP_INI_END()
index 98332cb68fb7fdfcb5824ca784d72e5e5e50311a..13afc0fb6ab60839083dd5d0884425c519188d93 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_PECL_HTTP_VERSION "2.2.0dev"
+#define PHP_PECL_HTTP_VERSION "3.0.0dev"
 
 extern zend_module_entry http_module_entry;
 #define phpext_http_ptr &http_module_entry
 
 extern zend_module_entry http_module_entry;
 #define phpext_http_ptr &http_module_entry
index 5bddb0c42e670a69fe0bdc6049614b97953354f5..1a848b299486c555ae51aa70d5d1fddceaaab9ec 100644 (file)
@@ -41,9 +41,6 @@
 # define PHP_HTTP_API extern
 #endif
 
 # define PHP_HTTP_API extern
 #endif
 
-/* make functions that return SUCCESS|FAILURE more obvious */
-typedef int STATUS;
-
 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
 #      define PHP_HTTP_HAVE_ICONV
 #endif
 #if (defined(HAVE_ICONV) || defined(PHP_HTTP_HAVE_EXT_ICONV)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_ICONV))
 #      define PHP_HTTP_HAVE_ICONV
 #endif
@@ -118,9 +115,9 @@ ZEND_EXTERN_MODULE_GLOBALS(php_http);
 
 #ifdef ZTS
 #      include "TSRM/TSRM.h"
 
 #ifdef ZTS
 #      include "TSRM/TSRM.h"
-#      define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
+#      define PHP_HTTP_G ((zend_php_http_globals *) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(php_http_globals_id)])
 #      undef TSRMLS_FETCH_FROM_CTX
 #      undef TSRMLS_FETCH_FROM_CTX
-#      define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = ((ctx)?(ctx):ts_resource_ex(0, NULL))
+#      define TSRMLS_FETCH_FROM_CTX(ctx) ERROR
 #else
 #      define PHP_HTTP_G (&php_http_globals)
 #endif
 #else
 #      define PHP_HTTP_G (&php_http_globals)
 #endif
index 6636e2c7dcfecd39a7e8b18bbdc45f00e1bd9e0e..059db0670e18cab29461c0c12fe7431c0b2692c0 100644 (file)
@@ -13,7 +13,8 @@
 #include <php.h>
 #include "php_http_buffer.h"
 
 #include <php.h>
 #include "php_http_buffer.h"
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t *buf, size_t chunk_size, int flags)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(
+               php_http_buffer_t *buf, size_t chunk_size, unsigned flags)
 {
        if (!buf) {
                buf = pemalloc(sizeof(*buf), flags & PHP_HTTP_BUFFER_INIT_PERSISTENT);
 {
        if (!buf) {
                buf = pemalloc(sizeof(*buf), flags & PHP_HTTP_BUFFER_INIT_PERSISTENT);
@@ -22,7 +23,8 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t
        if (buf) {
                buf->size = (chunk_size) ? chunk_size : PHP_HTTP_BUFFER_DEFAULT_SIZE;
                buf->pmem = (flags & PHP_HTTP_BUFFER_INIT_PERSISTENT) ? 1 : 0;
        if (buf) {
                buf->size = (chunk_size) ? chunk_size : PHP_HTTP_BUFFER_DEFAULT_SIZE;
                buf->pmem = (flags & PHP_HTTP_BUFFER_INIT_PERSISTENT) ? 1 : 0;
-               buf->data = (flags & PHP_HTTP_BUFFER_INIT_PREALLOC) ? pemalloc(buf->size, buf->pmem) : NULL;
+               buf->data = (flags & PHP_HTTP_BUFFER_INIT_PREALLOC) ?
+                               pemalloc(buf->size, buf->pmem) : NULL;
                buf->free = (flags & PHP_HTTP_BUFFER_INIT_PREALLOC) ? buf->size : 0;
                buf->used = 0;
        }
                buf->free = (flags & PHP_HTTP_BUFFER_INIT_PREALLOC) ? buf->size : 0;
                buf->used = 0;
        }
@@ -30,10 +32,11 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t
        return buf;
 }
 
        return buf;
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_buffer_t *buf, const char *string, size_t length)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(
+               php_http_buffer_t *buf, const char *str, size_t len)
 {
        if ((buf = php_http_buffer_init(buf))) {
 {
        if ((buf = php_http_buffer_init(buf))) {
-               if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, string, length)) {
+               if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(buf, str, len)) {
                        pefree(buf, buf->pmem);
                        buf = NULL;
                }
                        pefree(buf, buf->pmem);
                        buf = NULL;
                }
@@ -41,7 +44,9 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_b
        return buf;
 }
 
        return buf;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(php_http_buffer_t *buf, size_t len, size_t override_size, int allow_error)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(
+               php_http_buffer_t *buf, size_t len, size_t override_size,
+               zend_bool allow_error)
 {
        char *ptr = NULL;
 #if 0
 {
        char *ptr = NULL;
 #if 0
@@ -55,7 +60,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(php_http_buffer_t *buf, siz
                }
                
                if (allow_error) {
                }
                
                if (allow_error) {
-                       ptr = perealloc_recoverable(buf->data, buf->used + buf->free + size, buf->pmem);
+                       ptr = perealloc_recoverable(buf->data,
+                                       buf->used + buf->free + size, buf->pmem);
                } else {
                        ptr = perealloc(buf->data, buf->used + buf->free + size, buf->pmem);
                }
                } else {
                        ptr = perealloc(buf->data, buf->used + buf->free + size, buf->pmem);
                }
@@ -72,7 +78,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(php_http_buffer_t *buf, siz
        return 0;
 }
 
        return 0;
 }
 
-PHP_HTTP_BUFFER_API char *php_http_buffer_account(php_http_buffer_t *buf, size_t to_account)
+PHP_HTTP_BUFFER_API char *php_http_buffer_account(
+               php_http_buffer_t *buf, size_t to_account)
 {
        /* it's probably already too late but check anyway */
        if (to_account > buf->free) {
 {
        /* it's probably already too late but check anyway */
        if (to_account > buf->free) {
@@ -101,9 +108,12 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_shrink(php_http_buffer_t *buf)
        return buf->used;
 }
 
        return buf->used;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf, const char *append, size_t append_len)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf,
+               const char *append, size_t append_len)
 {
 {
-       if (buf->free < append_len && PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, append_len)) {
+       if (    buf->free < append_len &&
+                       PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, append_len)
+       ) {
                return PHP_HTTP_BUFFER_NOMEM;
        }
        memcpy(buf->data + buf->used, append, append_len);
                return PHP_HTTP_BUFFER_NOMEM;
        }
        memcpy(buf->data + buf->used, append, append_len);
@@ -112,7 +122,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf, const
        return append_len;
 }
 
        return append_len;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_appendf(php_http_buffer_t *buf, const char *format, ...)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_appendf(php_http_buffer_t *buf,
+               const char *format, ...)
 {
        va_list argv;
        char *append;
 {
        va_list argv;
        char *append;
@@ -131,7 +142,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_appendf(php_http_buffer_t *buf, const
        return append_len;
 }
 
        return append_len;
 }
 
-PHP_HTTP_BUFFER_API char *php_http_buffer_data(const php_http_buffer_t *buf, char **into, size_t *len)
+PHP_HTTP_BUFFER_API char *php_http_buffer_data(const php_http_buffer_t *buf,
+               char **into, size_t *len)
 {
        char *copy = ecalloc(1, buf->used + 1);
        memcpy(copy, buf->data, buf->used);
 {
        char *copy = ecalloc(1, buf->used + 1);
        memcpy(copy, buf->data, buf->used);
@@ -144,7 +156,8 @@ PHP_HTTP_BUFFER_API char *php_http_buffer_data(const php_http_buffer_t *buf, cha
        return copy;
 }
 
        return copy;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_cut(php_http_buffer_t *buf, size_t offset, size_t length)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_cut(php_http_buffer_t *buf,
+               size_t offset, size_t length)
 {
        if (offset > buf->used) {
                return 0;
 {
        if (offset > buf->used) {
                return 0;
@@ -152,15 +165,19 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_cut(php_http_buffer_t *buf, size_t of
        if (offset + length > buf->used) {
                length = buf->used - offset;
        }
        if (offset + length > buf->used) {
                length = buf->used - offset;
        }
-       memmove(buf->data + offset, buf->data + offset + length, buf->used - length - offset);
+       memmove(buf->data + offset, buf->data + offset + length,
+                       buf->used - length - offset);
        buf->used -= length;
        buf->free += length;
        return length;
 }
 
        buf->used -= length;
        buf->free += length;
        return length;
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_fix(php_http_buffer_t *buf)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_fix(
+               php_http_buffer_t *buf)
 {
 {
-       if (buf->free < 1 && PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize_ex(buf, 1, 1, 0)) {
+       if (    buf->free < 1 &&
+                       PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize_ex(buf, 1, 1, 0)
+       ) {
                return NULL;
        }
        buf->data[buf->used] = '\0';
                return NULL;
        }
        buf->data[buf->used] = '\0';
@@ -192,14 +209,16 @@ PHP_HTTP_BUFFER_API void php_http_buffer_free(php_http_buffer_t **buf)
        }
 }
 
        }
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_chunk_buffer(php_http_buffer_t **s, const char *data, size_t data_len, char **chunk, size_t chunk_size)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_chunk_buffer(php_http_buffer_t **s,
+               const char *data, size_t data_len, char **chunk, size_t chunk_size)
 {
        php_http_buffer_t *storage;
        
        *chunk = NULL;
        
        if (!*s) {
 {
        php_http_buffer_t *storage;
        
        *chunk = NULL;
        
        if (!*s) {
-               *s = php_http_buffer_init_ex(NULL, chunk_size << 1, chunk_size ? PHP_HTTP_BUFFER_INIT_PREALLOC : 0);
+               *s = php_http_buffer_init_ex(NULL, chunk_size << 1,
+                               chunk_size ? PHP_HTTP_BUFFER_INIT_PREALLOC : 0);
        }
        storage = *s;
        
        }
        storage = *s;
        
@@ -222,13 +241,15 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_chunk_buffer(php_http_buffer_t **s, c
        return 0;
 }
 
        return 0;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_output(php_http_buffer_t **s, const char *data, size_t data_len, size_t chunk_len, php_http_buffer_pass_func_t passout, void *opaque TSRMLS_DC)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_output(php_http_buffer_t **s,
+               const char *data, size_t data_len, size_t chunk_len,
+               php_http_buffer_pass_func_t passout, void *opaque)
 {
        char *chunk = NULL;
        size_t passed = 0, got = 0;
 
        while ((got = php_http_buffer_chunk_buffer(s, data, data_len, &chunk, chunk_len))) {
 {
        char *chunk = NULL;
        size_t passed = 0, got = 0;
 
        while ((got = php_http_buffer_chunk_buffer(s, data, data_len, &chunk, chunk_len))) {
-               if (PHP_HTTP_BUFFER_PASS0 == passout(opaque, chunk, got TSRMLS_CC)) {
+               if (PHP_HTTP_BUFFER_PASS0 == passout(opaque, chunk, got)) {
                        PTR_SET(chunk, NULL);
                        return PHP_HTTP_BUFFER_PASS0;
                }
                        PTR_SET(chunk, NULL);
                        return PHP_HTTP_BUFFER_PASS0;
                }
@@ -246,15 +267,19 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_output(php_http_buffer_t **s,
        return passed;
 }
 
        return passed;
 }
 
-PHP_HTTP_BUFFER_API ssize_t php_http_buffer_passthru(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *passin_arg, php_http_buffer_pass_func_t passon, void *passon_arg TSRMLS_DC)
+PHP_HTTP_BUFFER_API ssize_t php_http_buffer_passthru(php_http_buffer_t **s, size_t chunk_size,
+               php_http_buffer_pass_func_t passin, void *passin_arg,
+               php_http_buffer_pass_func_t passon, void *passon_arg)
 {
 {
-       size_t passed_on = 0, passed_in = php_http_buffer_chunked_input(s, chunk_size, passin, passin_arg TSRMLS_CC);
+       size_t passed_on = 0, passed_in;
+
+       passed_in = php_http_buffer_chunked_input(s, chunk_size, passin, passin_arg);
 
        if (passed_in == PHP_HTTP_BUFFER_PASS0) {
                return passed_in;
        }
        if (passed_in || (*s)->used) {
 
        if (passed_in == PHP_HTTP_BUFFER_PASS0) {
                return passed_in;
        }
        if (passed_in || (*s)->used) {
-               passed_on = passon(passon_arg, (*s)->data, (*s)->used TSRMLS_CC);
+               passed_on = passon(passon_arg, (*s)->data, (*s)->used);
 
                if (passed_on == PHP_HTTP_BUFFER_PASS0) {
                        return passed_on;
 
                if (passed_on == PHP_HTTP_BUFFER_PASS0) {
                        return passed_on;
@@ -268,18 +293,20 @@ PHP_HTTP_BUFFER_API ssize_t php_http_buffer_passthru(php_http_buffer_t **s, size
        return passed_on - passed_in;
 }
 
        return passed_on - passed_in;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_input(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *opaque TSRMLS_DC)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_input(php_http_buffer_t **s,
+               size_t chunk_size, php_http_buffer_pass_func_t passin, void *opaque)
 {
        php_http_buffer_t *str;
        size_t passed;
 
        if (!*s) {
 {
        php_http_buffer_t *str;
        size_t passed;
 
        if (!*s) {
-               *s = php_http_buffer_init_ex(NULL, chunk_size, chunk_size ? PHP_HTTP_BUFFER_INIT_PREALLOC : 0);
+               *s = php_http_buffer_init_ex(NULL, chunk_size,
+                               chunk_size ? PHP_HTTP_BUFFER_INIT_PREALLOC : 0);
        }
        str = *s;
 
        php_http_buffer_resize(str, chunk_size);
        }
        str = *s;
 
        php_http_buffer_resize(str, chunk_size);
-       passed = passin(opaque, str->data + str->used, chunk_size TSRMLS_CC);
+       passed = passin(opaque, str->data + str->used, chunk_size);
 
        if (passed != PHP_HTTP_BUFFER_PASS0) {
                str->used += passed;
 
        if (passed != PHP_HTTP_BUFFER_PASS0) {
                str->used += passed;
@@ -293,7 +320,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_input(php_http_buffer_t **s,
 
 #ifdef PHP_HTTP_BUFFER_EXTENDED
 
 
 #ifdef PHP_HTTP_BUFFER_EXTENDED
 
-PHP_HTTP_BUFFER_API int php_http_buffer_cmp(php_http_buffer_t *left, php_http_buffer_t *right)
+PHP_HTTP_BUFFER_API int php_http_buffer_cmp(php_http_buffer_t *left,
+               php_http_buffer_t *right)
 {
        if (left->used > right->used) {
                return -1;
 {
        if (left->used > right->used) {
                return -1;
@@ -304,7 +332,8 @@ PHP_HTTP_BUFFER_API int php_http_buffer_cmp(php_http_buffer_t *left, php_http_bu
        }
 }
 
        }
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_copy(const php_http_buffer_t *from, php_http_buffer_t *to)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_copy(
+               const php_http_buffer_t *from, php_http_buffer_t *to)
 {
        int free_to = !to;
 
 {
        int free_to = !to;
 
@@ -320,7 +349,8 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_copy(const php_http_buffe
        return to;
 }
 
        return to;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_insert(php_http_buffer_t *buf, const char *insert, size_t insert_len, size_t offset)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_insert(php_http_buffer_t *buf,
+               const char *insert, size_t insert_len, size_t offset)
 {
        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, insert_len)) {
                return PHP_HTTP_BUFFER_NOMEM;
 {
        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, insert_len)) {
                return PHP_HTTP_BUFFER_NOMEM;
@@ -332,7 +362,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_insert(php_http_buffer_t *buf, const
        return insert_len;
 }
 
        return insert_len;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_insertf(php_http_buffer_t *buf, size_t offset, const char *format, ...)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_insertf(php_http_buffer_t *buf,
+               size_t offset, const char *format, ...)
 {
        va_list argv;
        char *insert;
 {
        va_list argv;
        char *insert;
@@ -351,7 +382,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_insertf(php_http_buffer_t *buf, size_
        return insert_len;
 }
 
        return insert_len;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_prepend(php_http_buffer_t *buf, const char *prepend, size_t prepend_len)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_prepend(php_http_buffer_t *buf,
+               const char *prepend, size_t prepend_len)
 {
        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, prepend_len)) {
                return PHP_HTTP_BUFFER_NOMEM;
 {
        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_resize(buf, prepend_len)) {
                return PHP_HTTP_BUFFER_NOMEM;
@@ -363,7 +395,8 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_prepend(php_http_buffer_t *buf, const
        return prepend_len;
 }
 
        return prepend_len;
 }
 
-PHP_HTTP_BUFFER_API size_t php_http_buffer_prependf(php_http_buffer_t *buf, const char *format, ...)
+PHP_HTTP_BUFFER_API size_t php_http_buffer_prependf(php_http_buffer_t *buf,
+               const char *format, ...)
 {
        va_list argv;
        char *prepend;
 {
        va_list argv;
        char *prepend;
@@ -382,13 +415,20 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_prependf(php_http_buffer_t *buf, cons
        return prepend_len;
 }
 
        return prepend_len;
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_sub(const php_http_buffer_t *buf, size_t offset, size_t length)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_sub(
+               const php_http_buffer_t *buf, size_t offset, size_t length)
 {
        if (offset >= buf->used) {
                return NULL;
        } else {
 {
        if (offset >= buf->used) {
                return NULL;
        } else {
-               size_t need = 1 + ((length + offset) > buf->used ? (buf->used - offset) : (length - offset));
-               php_http_buffer_t *sub = php_http_buffer_init_ex(NULL, need, PHP_HTTP_BUFFER_INIT_PREALLOC | (buf->pmem ? PHP_HTTP_BUFFER_INIT_PERSISTENT:0));
+               php_http_buffer_t *sub;
+               size_t need = 1 + ((length + offset) > buf->used ?
+                               (buf->used - offset) : (length - offset));
+               unsigned flags = buf->pmem ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0;
+
+               sub = php_http_buffer_init_ex(NULL, need,
+                               PHP_HTTP_BUFFER_INIT_PREALLOC | flags);
+
                if (sub) {
                        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(sub, buf->data + offset, need)) {
                                php_http_buffer_free(&sub);
                if (sub) {
                        if (PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(sub, buf->data + offset, need)) {
                                php_http_buffer_free(&sub);
@@ -400,7 +440,8 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_sub(const php_http_buffer
        }
 }
 
        }
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_right(const php_http_buffer_t *buf, size_t length)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_right(
+               const php_http_buffer_t *buf, size_t length)
 {
        if (length < buf->used) {
                return php_http_buffer_sub(buf, buf->used - length, length);
 {
        if (length < buf->used) {
                return php_http_buffer_sub(buf, buf->used - length, length);
@@ -410,7 +451,8 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_right(const php_http_buff
 }
 
 
 }
 
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_merge_va(php_http_buffer_t *buf, unsigned argc, va_list argv)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_merge_va(
+               php_http_buffer_t *buf, unsigned argc, va_list argv)
 {
        unsigned i = 0;
        buf = php_http_buffer_init(buf);
 {
        unsigned i = 0;
        buf = php_http_buffer_init(buf);
@@ -427,7 +469,8 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_merge_va(php_http_buffer_
        return buf;
 }
 
        return buf;
 }
 
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_merge_ex(php_http_buffer_t *buf, unsigned argc, ...)
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_merge_ex(
+               php_http_buffer_t *buf, unsigned argc, ...)
 {
        va_list argv;
        php_http_buffer_t *ret;
 {
        va_list argv;
        php_http_buffer_t *ret;
index faf8992107675be7b39f744fc0ae069f9326a410..818c4430e5ed891e0144f29bae080a8d1cedb3c9 100644 (file)
                PTR = SET; \
        }
 #endif
                PTR = SET; \
        }
 #endif
-#ifndef TSRMLS_D
-#      define TSRMLS_D
-#      define TSRMLS_DC
-#      define TSRMLS_CC
-#      define TSRMLS_C
-#endif
 #ifdef PHP_ATTRIBUTE_FORMAT
 #      define PHP_HTTP_BUFFER_ATTRIBUTE_FORMAT(f, a, b) PHP_ATTRIBUTE_FORMAT(f, a, b)
 #else
 #ifdef PHP_ATTRIBUTE_FORMAT
 #      define PHP_HTTP_BUFFER_ATTRIBUTE_FORMAT(f, a, b) PHP_ATTRIBUTE_FORMAT(f, a, b)
 #else
@@ -84,7 +78,7 @@ static inline void *estrndup(void *p, size_t s)
        case PHP_HTTP_BUFFER_FREE_NOT: \
                break; \
        case PHP_HTTP_BUFFER_FREE_PTR: \
        case PHP_HTTP_BUFFER_FREE_NOT: \
                break; \
        case PHP_HTTP_BUFFER_FREE_PTR: \
-               pefree(STR, STR->pmem); break; \
+               pefree(STR, STR->pmem); \
                break; \
        case PHP_HTTP_BUFFER_FREE_VAL: \
                php_http_buffer_dtor(STR); \
                break; \
        case PHP_HTTP_BUFFER_FREE_VAL: \
                php_http_buffer_dtor(STR); \
@@ -142,7 +136,7 @@ typedef enum php_http_buffer_free {
 #define php_http_buffer_new() php_http_buffer_init(NULL)
 #define php_http_buffer_init(b) php_http_buffer_init_ex(b, PHP_HTTP_BUFFER_DEFAULT_SIZE, 0)
 #define php_http_buffer_clone(from, to) php_http_buffer_init_ex((to), (from)->size, (from)->pmem ? PHP_HTTP_BUFFER_INIT_PERSISTENT:0)
 #define php_http_buffer_new() php_http_buffer_init(NULL)
 #define php_http_buffer_init(b) php_http_buffer_init_ex(b, PHP_HTTP_BUFFER_DEFAULT_SIZE, 0)
 #define php_http_buffer_clone(from, to) php_http_buffer_init_ex((to), (from)->size, (from)->pmem ? PHP_HTTP_BUFFER_INIT_PERSISTENT:0)
-PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t *buf, size_t chunk_size, int flags);
+PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_init_ex(php_http_buffer_t *buf, size_t chunk_size, unsigned flags);
 
 /* create a php_http_buffer_t from a zval or c-string */
 #define php_http_buffer_from_zval(z) php_http_buffer_from_string(Z_STRVAL(z), Z_STRLEN(z))
 
 /* create a php_http_buffer_t from a zval or c-string */
 #define php_http_buffer_from_zval(z) php_http_buffer_from_string(Z_STRVAL(z), Z_STRLEN(z))
@@ -152,7 +146,7 @@ PHP_HTTP_BUFFER_API php_http_buffer_t *php_http_buffer_from_string_ex(php_http_b
 
 /* usually only called from within the internal functions */
 #define php_http_buffer_resize(b, s) php_http_buffer_resize_ex((b), (s), 0, 0)
 
 /* usually only called from within the internal functions */
 #define php_http_buffer_resize(b, s) php_http_buffer_resize_ex((b), (s), 0, 0)
-PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(php_http_buffer_t *buf, size_t len, size_t override_size, int allow_error);
+PHP_HTTP_BUFFER_API size_t php_http_buffer_resize_ex(php_http_buffer_t *buf, size_t len, size_t override_size, zend_bool allow_error);
 
 PHP_HTTP_BUFFER_API char *php_http_buffer_account(php_http_buffer_t *buf, size_t to_account);
 
 
 PHP_HTTP_BUFFER_API char *php_http_buffer_account(php_http_buffer_t *buf, size_t to_account);
 
@@ -162,6 +156,7 @@ PHP_HTTP_BUFFER_API size_t php_http_buffer_shrink(php_http_buffer_t *buf);
 /* append data to the php_http_buffer_t */
 #define php_http_buffer_appends(b, a) php_http_buffer_append((b), (a), sizeof(a)-1)
 #define php_http_buffer_appendl(b, a) php_http_buffer_append((b), (a), strlen(a))
 /* append data to the php_http_buffer_t */
 #define php_http_buffer_appends(b, a) php_http_buffer_append((b), (a), sizeof(a)-1)
 #define php_http_buffer_appendl(b, a) php_http_buffer_append((b), (a), strlen(a))
+#define php_http_buffer_appendz(b, z) php_http_buffer_append((b), (z)->val, (z)->len)
 PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf, const char *append, size_t append_len);
 PHP_HTTP_BUFFER_API size_t php_http_buffer_appendf(php_http_buffer_t *buf, const char *format, ...) PHP_HTTP_BUFFER_ATTRIBUTE_FORMAT(printf, 2, 3);
 
 PHP_HTTP_BUFFER_API size_t php_http_buffer_append(php_http_buffer_t *buf, const char *append, size_t append_len);
 PHP_HTTP_BUFFER_API size_t php_http_buffer_appendf(php_http_buffer_t *buf, const char *format, ...) PHP_HTTP_BUFFER_ATTRIBUTE_FORMAT(printf, 2, 3);
 
@@ -186,15 +181,15 @@ PHP_HTTP_BUFFER_API void php_http_buffer_free(php_http_buffer_t **buf);
 /* stores data in a php_http_buffer_t until it reaches chunk_size */
 PHP_HTTP_BUFFER_API size_t php_http_buffer_chunk_buffer(php_http_buffer_t **s, const char *data, size_t data_len, char **chunk, size_t chunk_size);
 
 /* stores data in a php_http_buffer_t until it reaches chunk_size */
 PHP_HTTP_BUFFER_API size_t php_http_buffer_chunk_buffer(php_http_buffer_t **s, const char *data, size_t data_len, char **chunk, size_t chunk_size);
 
-typedef size_t (*php_http_buffer_pass_func_t)(void *opaque, char *, size_t TSRMLS_DC);
+typedef size_t (*php_http_buffer_pass_func_t)(void *opaque, char *, size_t);
 
 
-PHP_HTTP_BUFFER_API ssize_t php_http_buffer_passthru(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *passin_arg, php_http_buffer_pass_func_t passon, void *passon_arg TSRMLS_DC);
+PHP_HTTP_BUFFER_API ssize_t php_http_buffer_passthru(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *passin_arg, php_http_buffer_pass_func_t passon, void *passon_arg);
 
 /* wrapper around php_http_buffer_chunk_buffer, which passes available chunks to passthru() */
 
 /* wrapper around php_http_buffer_chunk_buffer, which passes available chunks to passthru() */
-PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_output(php_http_buffer_t **s, const char *data, size_t data_len, size_t chunk_size, php_http_buffer_pass_func_t passout, void *opaque TSRMLS_DC);
+PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_output(php_http_buffer_t **s, const char *data, size_t data_len, size_t chunk_size, php_http_buffer_pass_func_t passout, void *opaque);
 
 /* write chunks directly into php_http_buffer_t buffer */
 
 /* write chunks directly into php_http_buffer_t buffer */
-PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_input(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *opaque TSRMLS_DC);
+PHP_HTTP_BUFFER_API size_t php_http_buffer_chunked_input(php_http_buffer_t **s, size_t chunk_size, php_http_buffer_pass_func_t passin, void *opaque);
 
 
 #      ifdef PHP_HTTP_BUFFER_EXTENDED
 
 
 #      ifdef PHP_HTTP_BUFFER_EXTENDED
index f96164bbba08ad449733b745503149948412de03..504e961d56a75c6f2744117da972f422bffab08d 100644 (file)
  */
 static HashTable php_http_client_drivers;
 
  */
 static HashTable php_http_client_drivers;
 
-STATUS php_http_client_driver_add(php_http_client_driver_t *driver)
+ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver)
 {
        return zend_hash_add(&php_http_client_drivers, driver->name_str, driver->name_len + 1, (void *) driver, sizeof(php_http_client_driver_t), NULL);
 }
 
 {
        return zend_hash_add(&php_http_client_drivers, driver->name_str, driver->name_len + 1, (void *) driver, sizeof(php_http_client_driver_t), NULL);
 }
 
-STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver)
+ZEND_RESULT_CODE php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver)
 {
        php_http_client_driver_t *tmp;
 
 {
        php_http_client_driver_t *tmp;
 
@@ -216,7 +216,7 @@ void php_http_client_free(php_http_client_t **h) {
        }
 }
 
        }
 }
 
-STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
+ZEND_RESULT_CODE php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
 {
        TSRMLS_FETCH_FROM_CTX(h->ts);
 
 {
        TSRMLS_FETCH_FROM_CTX(h->ts);
 
@@ -231,7 +231,7 @@ STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-STATUS php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request)
+ZEND_RESULT_CODE php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request)
 {
        TSRMLS_FETCH_FROM_CTX(h->ts);
 
 {
        TSRMLS_FETCH_FROM_CTX(h->ts);
 
@@ -267,7 +267,7 @@ php_http_client_enqueue_t *php_http_client_enqueued(php_http_client_t *h, void *
        return el ? (php_http_client_enqueue_t *) el->data : NULL;
 }
 
        return el ? (php_http_client_enqueue_t *) el->data : NULL;
 }
 
-STATUS php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout)
+ZEND_RESULT_CODE php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout)
 {
        if (h->ops->wait) {
                return h->ops->wait(h, custom_timeout);
 {
        if (h->ops->wait) {
                return h->ops->wait(h, custom_timeout);
@@ -285,7 +285,7 @@ int php_http_client_once(php_http_client_t *h)
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-STATUS php_http_client_exec(php_http_client_t *h)
+ZEND_RESULT_CODE php_http_client_exec(php_http_client_t *h)
 {
        if (h->ops->exec) {
                return h->ops->exec(h);
 {
        if (h->ops->exec) {
                return h->ops->exec(h);
@@ -304,7 +304,7 @@ void php_http_client_reset(php_http_client_t *h)
        zend_llist_clean(&h->responses);
 }
 
        zend_llist_clean(&h->responses);
 }
 
-STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg)
+ZEND_RESULT_CODE php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg)
 {
        if (h->ops->setopt) {
                return h->ops->setopt(h, opt, arg);
 {
        if (h->ops->setopt) {
                return h->ops->setopt(h, opt, arg);
@@ -313,7 +313,7 @@ STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-STATUS php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr)
+ZEND_RESULT_CODE php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr)
 {
        if (h->ops->getopt) {
                return h->ops->getopt(h, opt, arg, res_ptr);
 {
        if (h->ops->getopt) {
                return h->ops->getopt(h, opt, arg, res_ptr);
@@ -361,7 +361,9 @@ zend_object_value php_http_client_object_new(zend_class_entry *ce TSRMLS_DC)
 static void handle_history(zval *zclient, php_http_message_t *request, php_http_message_t *response TSRMLS_DC)
 {
        zval *new_hist, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0 TSRMLS_CC);
 static void handle_history(zval *zclient, php_http_message_t *request, php_http_message_t *response TSRMLS_DC)
 {
        zval *new_hist, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0 TSRMLS_CC);
-       php_http_message_t *zipped = php_http_message_zip(response, request);
+       php_http_message_t *req_copy = php_http_message_copy(request, NULL);
+       php_http_message_t *res_copy = php_http_message_copy(response, NULL);
+       php_http_message_t *zipped = php_http_message_zip(res_copy, req_copy);
        zend_object_value ov = php_http_message_object_new_ex(php_http_message_class_entry, zipped, NULL TSRMLS_CC);
 
        MAKE_STD_ZVAL(new_hist);
        zend_object_value ov = php_http_message_object_new_ex(php_http_message_class_entry, zipped, NULL TSRMLS_CC);
 
        MAKE_STD_ZVAL(new_hist);
@@ -375,7 +377,7 @@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_
        zval_ptr_dtor(&new_hist);
 }
 
        zval_ptr_dtor(&new_hist);
 }
 
-static STATUS handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response)
+static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response)
 {
        zend_bool dequeue = 0;
        zval zclient;
 {
        zend_bool dequeue = 0;
        zval zclient;
index 6c455166e6233c877862f769a27ece04865608de..d230fed64e39790fe2a309f30afce9cb222490b0 100644 (file)
@@ -38,13 +38,13 @@ typedef struct php_http_client *(*php_http_client_init_func_t)(struct php_http_c
 typedef struct php_http_client *(*php_http_client_copy_func_t)(struct php_http_client *from, struct php_http_client *to);
 typedef void (*php_http_client_dtor_func_t)(struct php_http_client *p);
 typedef void (*php_http_client_reset_func_t)(struct php_http_client *p);
 typedef struct php_http_client *(*php_http_client_copy_func_t)(struct php_http_client *from, struct php_http_client *to);
 typedef void (*php_http_client_dtor_func_t)(struct php_http_client *p);
 typedef void (*php_http_client_reset_func_t)(struct php_http_client *p);
-typedef STATUS (*php_http_client_exec_func_t)(struct php_http_client *p);
+typedef ZEND_RESULT_CODE (*php_http_client_exec_func_t)(struct php_http_client *p);
 typedef int (*php_http_client_once_func_t)(struct php_http_client *p);
 typedef int (*php_http_client_once_func_t)(struct php_http_client *p);
-typedef STATUS (*php_http_client_wait_func_t)(struct php_http_client *p, struct timeval *custom_timeout);
-typedef STATUS (*php_http_client_enqueue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue);
-typedef STATUS (*php_http_client_dequeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue);
-typedef STATUS (*php_http_client_setopt_func_t)(struct php_http_client *p, php_http_client_setopt_opt_t opt, void *arg);
-typedef STATUS (*php_http_client_getopt_func_t)(struct php_http_client *h, php_http_client_getopt_opt_t opt, void *arg, void **res);
+typedef ZEND_RESULT_CODE (*php_http_client_wait_func_t)(struct php_http_client *p, struct timeval *custom_timeout);
+typedef ZEND_RESULT_CODE (*php_http_client_enqueue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue);
+typedef ZEND_RESULT_CODE (*php_http_client_dequeue_func_t)(struct php_http_client *p, php_http_client_enqueue_t *enqueue);
+typedef ZEND_RESULT_CODE (*php_http_client_setopt_func_t)(struct php_http_client *p, php_http_client_setopt_opt_t opt, void *arg);
+typedef ZEND_RESULT_CODE (*php_http_client_getopt_func_t)(struct php_http_client *h, php_http_client_getopt_opt_t opt, void *arg, void **res);
 
 typedef struct php_http_client_ops {
        php_resource_factory_ops_t *rsrc;
 
 typedef struct php_http_client_ops {
        php_resource_factory_ops_t *rsrc;
@@ -67,8 +67,8 @@ typedef struct php_http_client_driver {
        php_http_client_ops_t *client_ops;
 } php_http_client_driver_t;
 
        php_http_client_ops_t *client_ops;
 } php_http_client_driver_t;
 
-PHP_HTTP_API STATUS php_http_client_driver_add(php_http_client_driver_t *driver);
-PHP_HTTP_API STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver);
 
 typedef struct php_http_client_progress_state {
        struct {
 
 typedef struct php_http_client_progress_state {
        struct {
@@ -84,7 +84,7 @@ typedef struct php_http_client_progress_state {
        unsigned finished:1;
 } php_http_client_progress_state_t;
 
        unsigned finished:1;
 } php_http_client_progress_state_t;
 
-typedef STATUS (*php_http_client_response_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response);
+typedef ZEND_RESULT_CODE (*php_http_client_response_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response);
 typedef void (*php_http_client_progress_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *state);
 
 typedef struct php_http_client {
 typedef void (*php_http_client_progress_callback_t)(void *arg, struct php_http_client *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *state);
 
 typedef struct php_http_client {
@@ -125,17 +125,17 @@ PHP_HTTP_API php_http_client_t *php_http_client_copy(php_http_client_t *from, ph
 PHP_HTTP_API void php_http_client_dtor(php_http_client_t *h);
 PHP_HTTP_API void php_http_client_free(php_http_client_t **h);
 
 PHP_HTTP_API void php_http_client_dtor(php_http_client_t *h);
 PHP_HTTP_API void php_http_client_free(php_http_client_t **h);
 
-PHP_HTTP_API STATUS php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue);
-PHP_HTTP_API STATUS php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_dequeue(php_http_client_t *h, php_http_message_t *request);
 
 
-PHP_HTTP_API STATUS php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_wait(php_http_client_t *h, struct timeval *custom_timeout);
 PHP_HTTP_API int php_http_client_once(php_http_client_t *h);
 
 PHP_HTTP_API int php_http_client_once(php_http_client_t *h);
 
-PHP_HTTP_API STATUS php_http_client_exec(php_http_client_t *h);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_exec(php_http_client_t *h);
 PHP_HTTP_API void php_http_client_reset(php_http_client_t *h);
 
 PHP_HTTP_API void php_http_client_reset(php_http_client_t *h);
 
-PHP_HTTP_API STATUS php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg);
-PHP_HTTP_API STATUS php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_client_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void *res_ptr);
 
 typedef int (*php_http_client_enqueue_cmp_func_t)(php_http_client_enqueue_t *cmp, void *arg);
 /* compare with request message pointer if compare_func is NULL */
 
 typedef int (*php_http_client_enqueue_cmp_func_t)(php_http_client_enqueue_t *cmp, void *arg);
 /* compare with request message pointer if compare_func is NULL */
index b057216a8cfb80bad4b4aee58b65d6b19b40b0ed..8304b30dab9f78fc0bdbb738a2bc8bc54dfb18e4 100644 (file)
@@ -344,7 +344,7 @@ static int php_http_curle_dummy_callback(char *data, size_t n, size_t l, void *s
        return n*l;
 }
 
        return n*l;
 }
 
-static STATUS php_http_curle_get_info(CURL *ch, HashTable *info)
+static ZEND_RESULT_CODE php_http_curle_get_info(CURL *ch, HashTable *info)
 {
        char *c;
        long l;
 {
        char *c;
        long l;
@@ -805,7 +805,7 @@ static php_http_options_t php_http_curle_options;
 #define PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR            0x0002
 #define PHP_HTTP_CURLE_OPTION_TRANSFORM_MS             0x0004
 
 #define PHP_HTTP_CURLE_OPTION_CHECK_BASEDIR            0x0002
 #define PHP_HTTP_CURLE_OPTION_TRANSFORM_MS             0x0004
 
-static STATUS php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -816,7 +816,7 @@ static STATUS php_http_curle_option_set_ssl_verifyhost(php_http_option_t *opt, z
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -838,7 +838,7 @@ static STATUS php_http_curle_option_set_cookiestore(php_http_option_t *opt, zval
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_cookies(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_cookies(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -885,7 +885,7 @@ static STATUS php_http_curle_option_set_cookies(php_http_option_t *opt, zval *va
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_encodecookies(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_encodecookies(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
 
 {
        php_http_client_curl_handler_t *curl = userdata;
 
@@ -893,7 +893,7 @@ static STATUS php_http_curle_option_set_encodecookies(php_http_option_t *opt, zv
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_lastmodified(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_lastmodified(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -922,7 +922,7 @@ static STATUS php_http_curle_option_set_lastmodified(php_http_option_t *opt, zva
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_compress(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
 
 {
        php_http_client_curl_handler_t *curl = userdata;
 
@@ -932,7 +932,7 @@ static STATUS php_http_curle_option_set_compress(php_http_option_t *opt, zval *v
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_etag(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_etag(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        php_http_buffer_t header;
 {
        php_http_client_curl_handler_t *curl = userdata;
        php_http_buffer_t header;
@@ -948,7 +948,7 @@ static STATUS php_http_curle_option_set_etag(php_http_option_t *opt, zval *val,
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_range(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_range(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -992,7 +992,7 @@ static STATUS php_http_curle_option_set_range(php_http_option_t *opt, zval *val,
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_resume(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_resume(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -1006,7 +1006,7 @@ static STATUS php_http_curle_option_set_resume(php_http_option_t *opt, zval *val
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
 
 {
        php_http_client_curl_handler_t *curl = userdata;
 
@@ -1014,7 +1014,7 @@ static STATUS php_http_curle_option_set_retrydelay(php_http_option_t *opt, zval
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_retrycount(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_retrycount(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
 
 {
        php_http_client_curl_handler_t *curl = userdata;
 
@@ -1022,7 +1022,7 @@ static STATUS php_http_curle_option_set_retrycount(php_http_option_t *opt, zval
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_redirect(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_redirect(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -1035,7 +1035,7 @@ static STATUS php_http_curle_option_set_redirect(php_http_option_t *opt, zval *v
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_curle_option_set_portrange(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_portrange(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -1074,7 +1074,7 @@ static STATUS php_http_curle_option_set_portrange(php_http_option_t *opt, zval *
 }
 
 #if PHP_HTTP_CURL_VERSION(7,21,3)
 }
 
 #if PHP_HTTP_CURL_VERSION(7,21,3)
-static STATUS php_http_curle_option_set_resolve(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_option_set_resolve(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
@@ -1394,13 +1394,13 @@ static zval *php_http_curle_get_option(php_http_option_t *opt, HashTable *option
        return option;
 }
 
        return option;
 }
 
-static STATUS php_http_curle_set_option(php_http_option_t *opt, zval *val, void *userdata)
+static ZEND_RESULT_CODE php_http_curle_set_option(php_http_option_t *opt, zval *val, void *userdata)
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
        zval tmp;
        CURLcode rc = CURLE_OK;
 {
        php_http_client_curl_handler_t *curl = userdata;
        CURL *ch = curl->handle;
        zval tmp;
        CURLcode rc = CURLE_OK;
-       STATUS rv = SUCCESS;
+       ZEND_RESULT_CODE rv = SUCCESS;
        TSRMLS_FETCH_FROM_CTX(curl->client->ts);
 
        if (!val) {
        TSRMLS_FETCH_FROM_CTX(curl->client->ts);
 
        if (!val) {
@@ -1478,7 +1478,7 @@ static STATUS php_http_curle_set_option(php_http_option_t *opt, zval *val, void
 
 /* client ops */
 
 
 /* client ops */
 
-static STATUS php_http_client_curl_handler_reset(php_http_client_curl_handler_t *curl)
+static ZEND_RESULT_CODE php_http_client_curl_handler_reset(php_http_client_curl_handler_t *curl)
 {
        CURL *ch = curl->handle;
        php_http_curle_storage_t *st;
 {
        CURL *ch = curl->handle;
        php_http_curle_storage_t *st;
@@ -1582,7 +1582,7 @@ static php_http_client_curl_handler_t *php_http_client_curl_handler_init(php_htt
 }
 
 
 }
 
 
-static STATUS php_http_client_curl_handler_prepare(php_http_client_curl_handler_t *curl, php_http_client_enqueue_t *enqueue)
+static ZEND_RESULT_CODE php_http_client_curl_handler_prepare(php_http_client_curl_handler_t *curl, php_http_client_enqueue_t *enqueue)
 {
        size_t body_size;
        php_http_message_t *msg = enqueue->request;
 {
        size_t body_size;
        php_http_message_t *msg = enqueue->request;
@@ -1810,7 +1810,7 @@ static php_resource_factory_t *create_rf(php_http_url_t *url TSRMLS_DC)
        return rf;
 }
 
        return rf;
 }
 
-static STATUS php_http_client_curl_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
+static ZEND_RESULT_CODE php_http_client_curl_enqueue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
 {
        CURLMcode rs;
        php_http_client_curl_t *curl = h->ctx;
 {
        CURLMcode rs;
        php_http_client_curl_t *curl = h->ctx;
@@ -1855,7 +1855,7 @@ static STATUS php_http_client_curl_enqueue(php_http_client_t *h, php_http_client
        }
 }
 
        }
 }
 
-static STATUS php_http_client_curl_dequeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
+static ZEND_RESULT_CODE php_http_client_curl_dequeue(php_http_client_t *h, php_http_client_enqueue_t *enqueue)
 {
        CURLMcode rs;
        php_http_client_curl_t *curl = h->ctx;
 {
        CURLMcode rs;
        php_http_client_curl_t *curl = h->ctx;
@@ -1900,7 +1900,7 @@ static inline void php_http_client_curl_get_timeout(php_http_client_curl_t *curl
 #      define SELECT_ERROR -1
 #endif
 
 #      define SELECT_ERROR -1
 #endif
 
-static STATUS php_http_client_curl_wait(php_http_client_t *h, struct timeval *custom_timeout)
+static ZEND_RESULT_CODE php_http_client_curl_wait(php_http_client_t *h, struct timeval *custom_timeout)
 {
        int MAX;
        fd_set R, W, E;
 {
        int MAX;
        fd_set R, W, E;
@@ -1962,7 +1962,7 @@ static int php_http_client_curl_once(php_http_client_t *h)
 
 }
 
 
 }
 
-static STATUS php_http_client_curl_exec(php_http_client_t *h)
+static ZEND_RESULT_CODE php_http_client_curl_exec(php_http_client_t *h)
 {
 #if PHP_HTTP_HAVE_EVENT
        php_http_client_curl_t *curl = h->ctx;
 {
 #if PHP_HTTP_HAVE_EVENT
        php_http_client_curl_t *curl = h->ctx;
@@ -2003,7 +2003,7 @@ static STATUS php_http_client_curl_exec(php_http_client_t *h)
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_client_curl_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg)
+static ZEND_RESULT_CODE php_http_client_curl_setopt(php_http_client_t *h, php_http_client_setopt_opt_t opt, void *arg)
 {
        php_http_client_curl_t *curl = h->ctx;
 
 {
        php_http_client_curl_t *curl = h->ctx;
 
@@ -2042,7 +2042,7 @@ static STATUS php_http_client_curl_setopt(php_http_client_t *h, php_http_client_
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res)
+static ZEND_RESULT_CODE php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res)
 {
        php_http_client_enqueue_t *enqueue;
 
 {
        php_http_client_enqueue_t *enqueue;
 
index 354dfa6ed4f0315aa8dbb0e43fb4062281351316..a04de835a1ea1a0da2e3817305e4464742e5fe11 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list TSRMLS_DC)
+php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list)
 {
        if (!list) {
                list = emalloc(sizeof(*list));
 {
        if (!list) {
                list = emalloc(sizeof(*list));
@@ -27,16 +27,12 @@ php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list T
        list->max_age = -1;
        list->flags = 0;
        
        list->max_age = -1;
        list->flags = 0;
        
-       TSRMLS_SET_CTX(list->ts);
-
        return list;
 }
 
 php_http_cookie_list_t *php_http_cookie_list_copy(php_http_cookie_list_t *from, php_http_cookie_list_t *to)
 {
        return list;
 }
 
 php_http_cookie_list_t *php_http_cookie_list_copy(php_http_cookie_list_t *from, php_http_cookie_list_t *to)
 {
-       TSRMLS_FETCH_FROM_CTX(from->ts);
-
-       to = php_http_cookie_list_init(to TSRMLS_CC);
+       to = php_http_cookie_list_init(to);
 
        array_copy(&from->cookies, &to->cookies);
        array_copy(&from->extras, &to->extras);
 
        array_copy(&from->cookies, &to->cookies);
        array_copy(&from->extras, &to->extras);
@@ -72,56 +68,60 @@ void php_http_cookie_list_free(php_http_cookie_list_t **list)
        }
 }
 
        }
 }
 
-const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, zval **zcookie)
+const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, zval *zcookie)
 {
 {
-       zval **cookie;
-       if ((SUCCESS != zend_symtable_find(&list->cookies, name, name_len + 1, (void *) &cookie)) || (Z_TYPE_PP(cookie) != IS_STRING)) {
+       zval *cookie = zend_symtable_str_find(&list->cookies, name, name_len);
+
+       if (!cookie || (Z_TYPE_P(cookie) != IS_STRING)) {
                return NULL;
        }
        if (zcookie) {
                *zcookie = *cookie;
        }
                return NULL;
        }
        if (zcookie) {
                *zcookie = *cookie;
        }
-       return Z_STRVAL_PP(cookie);
+       return Z_STRVAL_P(cookie);
 }
 
 }
 
-const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, zval **zextra)
+const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, zval *zextra)
 {
 {
-       zval **extra;
+       zval *extra = zend_symtable_str_find(&list->extras, name, name_len);
 
 
-       if ((SUCCESS != zend_symtable_find(&list->extras, name, name_len + 1, (void *) &extra)) || (Z_TYPE_PP(extra) != IS_STRING)) {
+       if (!extra || (Z_TYPE_P(extra) != IS_STRING)) {
                return NULL;
        }
        if (zextra) {
                *zextra = *extra;
        }
                return NULL;
        }
        if (zextra) {
                *zextra = *extra;
        }
-       return Z_STRVAL_PP(extra);
+       return Z_STRVAL_P(extra);
 }
 
 void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len)
 {
 }
 
 void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len)
 {
-       zval *cookie_value;
+       zval cookie_value;
 
 
-       MAKE_STD_ZVAL(cookie_value);
-       ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
-       zend_symtable_update(&list->cookies, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+       ZVAL_STRINGL(&cookie_value, value, value_len);
+       zend_symtable_str_update(&list->cookies, name, name_len, &cookie_value);
 }
 
 void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len)
 {
 }
 
 void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len)
 {
-       zval *cookie_value;
+       zval extra_value;
 
 
-       MAKE_STD_ZVAL(cookie_value);
-       ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
-       zend_symtable_update(&list->extras, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+       ZVAL_STRINGL(&extra_value, value, value_len);
+       zend_symtable_str_update(&list->extras, name, name_len, &extra_value);
 }
 
 }
 
-#define _KEY_IS(s) (key->len == sizeof(s) && !strncasecmp(key->str, (s), key->len))
-static void add_entry(php_http_cookie_list_t *list, char **allowed_extras, long flags, php_http_array_hashkey_t *key, zval *val)
+#define _KEY_IS(s) (key->key && key->key->len == sizeof(s)-1 && !strncasecmp(key->key->val, (s), key->key->len))
+static void add_entry(php_http_cookie_list_t *list, char **allowed_extras, long flags, zend_hash_key *key, zval *val)
 {
 {
-       zval *arg = php_http_zsep(1, IS_STRING, val);
+       zval *arg = val;
+
+       Z_TRY_ADDREF_P(arg);
+       SEPARATE_ZVAL(arg);
+       convert_to_string(arg);
 
        if (!(flags & PHP_HTTP_COOKIE_PARSE_RAW)) {
                Z_STRLEN_P(arg) = php_raw_url_decode(Z_STRVAL_P(arg), Z_STRLEN_P(arg));
 
        if (!(flags & PHP_HTTP_COOKIE_PARSE_RAW)) {
                Z_STRLEN_P(arg) = php_raw_url_decode(Z_STRVAL_P(arg), Z_STRLEN_P(arg));
+               zend_string_forget_hash_val(Z_STR_P(arg));
        }
 
        if _KEY_IS("path") {
        }
 
        if _KEY_IS("path") {
@@ -139,65 +139,63 @@ static void add_entry(php_http_cookie_list_t *list, char **allowed_extras, long
        } else if _KEY_IS("httpOnly") {
                list->flags |= PHP_HTTP_COOKIE_HTTPONLY;
        } else {
        } else if _KEY_IS("httpOnly") {
                list->flags |= PHP_HTTP_COOKIE_HTTPONLY;
        } else {
+               php_http_arrkey_t tmp = {0};
+
+               php_http_arrkey_stringify(&tmp, key);
+
                /* check for extra */
                if (allowed_extras) {
                        char **ae = allowed_extras;
                /* check for extra */
                if (allowed_extras) {
                        char **ae = allowed_extras;
-
-                       php_http_array_hashkey_stringify(key);
                        for (; *ae; ++ae) {
                        for (; *ae; ++ae) {
-                               if (!strncasecmp(key->str, *ae, key->len)) {
-                                       if (key->type == HASH_KEY_IS_LONG) {
-                                               zend_hash_index_update(&list->extras, key->num, (void *) &arg, sizeof(zval *), NULL);
-                                       } else {
-                                               zend_hash_update(&list->extras, key->str, key->len, (void *) &arg, sizeof(zval *), NULL);
-                                       }
-                                       php_http_array_hashkey_stringfree(key);
+                               if (!strncasecmp(*ae, tmp.key->val, tmp.key->len)) {
+                                       zend_symtable_update(&list->extras, tmp.key, arg);
+                                       php_http_arrkey_dtor(&tmp);
                                        return;
                                }
                        }
                                        return;
                                }
                        }
-                       php_http_array_hashkey_stringfree(key);
                }
 
                /* cookie */
                }
 
                /* cookie */
-               if (key->type == HASH_KEY_IS_LONG) {
-                       zend_hash_index_update(&list->cookies, key->num, (void *) &arg, sizeof(zval *), NULL);
-               } else {
-                       zend_hash_update(&list->cookies, key->str, key->len, (void *) &arg, sizeof(zval *), NULL);
-               }
+               zend_symtable_update(&list->cookies, key->key, arg);
+
+               php_http_arrkey_dtor(&tmp);
                return;
        }
                return;
        }
-       zval_ptr_dtor(&arg);
+
+       zval_ptr_dtor(arg);
 }
 
 }
 
-php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t *list, const char *str, size_t len, long flags, char **allowed_extras TSRMLS_DC)
+php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t *list, const char *str, size_t len, long flags, char **allowed_extras)
 {
        php_http_params_opts_t opts;
        HashTable params;
 {
        php_http_params_opts_t opts;
        HashTable params;
-       HashPosition pos1, pos2;
-       php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-       zval **param, **val, **args, **arg;
+       zend_hash_key k, arg_k;
+       zval *param, *val, *args, *arg;
 
        php_http_params_opts_default_get(&opts);
        opts.input.str = estrndup(str, len);
        opts.input.len = len;
        opts.param = NULL;
        zend_hash_init(&params, 10, NULL, ZVAL_PTR_DTOR, 0);
 
        php_http_params_opts_default_get(&opts);
        opts.input.str = estrndup(str, len);
        opts.input.len = len;
        opts.param = NULL;
        zend_hash_init(&params, 10, NULL, ZVAL_PTR_DTOR, 0);
-       php_http_params_parse(&params, &opts TSRMLS_CC);
+       php_http_params_parse(&params, &opts);
        efree(opts.input.str);
 
        efree(opts.input.str);
 
-       list = php_http_cookie_list_init(list TSRMLS_CC);
-       FOREACH_HASH_KEYVAL(pos1, &params, key, param) {
-               if (Z_TYPE_PP(param) == IS_ARRAY) {
-                       if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(param), ZEND_STRS("value"), (void *) &val)) {
-                               add_entry(list, NULL, flags, &key, *val);
+       list = php_http_cookie_list_init(list);
+       ZEND_HASH_FOREACH_KEY_VAL(&params, k.h, k.key, param)
+       {
+               if (Z_TYPE_P(param) == IS_ARRAY) {
+                       if ((val = zend_hash_str_find(Z_ARRVAL_P(param), ZEND_STRL("value")))) {
+                               add_entry(list, NULL, flags, &k, val);
                        }
                        }
-                       if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(param), ZEND_STRS("arguments"), (void *) &args) && Z_TYPE_PP(args) == IS_ARRAY) {
-                               FOREACH_KEYVAL(pos2, *args, key, arg) {
-                                       add_entry(list, allowed_extras, flags, &key, *arg);
-                               }
+                       if ((args = zend_hash_str_find(Z_ARRVAL_P(param), ZEND_STRL("arguments"))) && Z_TYPE_P(args) == IS_ARRAY) {
+                               ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(args), arg_k.h, arg_k.key, arg) {
+                                       add_entry(list, allowed_extras, flags, &arg_k, arg);
+                               } ZEND_HASH_FOREACH_END();
                        }
                }
        }
                        }
                }
        }
+       ZEND_HASH_FOREACH_END();
+
        zend_hash_destroy(&params);
 
        return list;
        zend_hash_destroy(&params);
 
        return list;
@@ -205,81 +203,87 @@ php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t *list,
 
 void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct)
 {
 
 void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct)
 {
-       zval array, *cookies, *extras;
-       TSRMLS_FETCH_FROM_CTX(list->ts);
-       
-       INIT_PZVAL_ARRAY(&array, HASH_OF(strct));
+       zval cookies, extras, tmp;
+       HashTable *ht = HASH_OF(strct);
        
        
-       MAKE_STD_ZVAL(cookies);
-       array_init(cookies);
-       zend_hash_copy(Z_ARRVAL_P(cookies), &list->cookies, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-       add_assoc_zval(&array, "cookies", cookies);
+       array_init_size(&cookies, zend_hash_num_elements(&list->cookies));
+       array_copy(&list->cookies, Z_ARRVAL(cookies));
+       zend_symtable_str_update(ht, ZEND_STRL("cookies"), &cookies);
        
        
-       MAKE_STD_ZVAL(extras);
-       array_init(extras);
-       zend_hash_copy(Z_ARRVAL_P(extras), &list->extras, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-       add_assoc_zval(&array, "extras", extras);
+       array_init_size(&extras, zend_hash_num_elements(&list->extras));
+       array_copy(&list->extras, Z_ARRVAL(extras));
+       zend_symtable_str_update(ht, ZEND_STRL("extras"), &extras);
        
        
-       add_assoc_long(&array, "flags", list->flags);
-       add_assoc_long(&array, "expires", (long) list->expires);
-       add_assoc_long(&array, "max-age", (long) list->max_age);
-       add_assoc_string(&array, "path", STR_PTR(list->path), 1);
-       add_assoc_string(&array, "domain", STR_PTR(list->domain), 1);
+       ZVAL_LONG(&tmp, list->flags);
+       zend_symtable_str_update(ht, ZEND_STRL("flags"), &tmp);
+       ZVAL_LONG(&tmp, list->expires);
+       zend_symtable_str_update(ht, ZEND_STRL("expires"), &tmp);
+       ZVAL_LONG(&tmp, list->max_age);
+       zend_symtable_str_update(ht, ZEND_STRL("max-age"), &tmp);
+       ZVAL_STRING(&tmp, STR_PTR(list->path));
+       zend_symtable_str_update(ht, ZEND_STRL("path"), &tmp);
+       ZVAL_STRING(&tmp, STR_PTR(list->domain));
+       zend_symtable_str_update(ht, ZEND_STRL("domain"), &tmp);
 }
 
 }
 
-php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC)
+php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct)
 {
 {
-       zval **tmp, *cpy;
-       HashTable *ht = HASH_OF(strct);
-       
-       list = php_http_cookie_list_init(list TSRMLS_CC);
-       
-       if (SUCCESS == zend_hash_find(ht, "cookies", sizeof("cookies"), (void *) &tmp) && Z_TYPE_PP(tmp) == IS_ARRAY) {
-               zend_hash_copy(&list->cookies, Z_ARRVAL_PP(tmp), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+       zval *tmp;
+       HashTable *ht;
+
+       ht = HASH_OF(strct);
+       list = php_http_cookie_list_init(list);
+
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("cookies"))) && Z_TYPE_P(tmp) == IS_ARRAY){
+               array_copy(Z_ARRVAL_P(tmp), &list->cookies);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "extras", sizeof("extras"), (void *) &tmp) && Z_TYPE_PP(tmp) == IS_ARRAY) {
-               zend_hash_copy(&list->extras, Z_ARRVAL_PP(tmp), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("extras"))) && Z_TYPE_P(tmp) == IS_ARRAY){
+               array_copy(Z_ARRVAL_P(tmp), &list->extras);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "flags", sizeof("flags"), (void *) &tmp)) {
-               cpy = php_http_ztyp(IS_LONG, *tmp);
-               list->flags = Z_LVAL_P(cpy);
-               zval_ptr_dtor(&cpy);
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("flags")))) {
+               list->flags = zval_get_long(tmp);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "expires", sizeof("expires"), (void *) &tmp)) {
-               if (Z_TYPE_PP(tmp) == IS_LONG) {
-                       list->expires = Z_LVAL_PP(tmp);
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("expires")))) {
+               if (Z_TYPE_P(tmp) == IS_LONG) {
+                       list->expires = Z_LVAL_P(tmp);
                } else {
                } else {
-                       long lval;
+                       zend_long lval;
+                       zend_string *lstr = zval_get_string(tmp);
 
 
-                       cpy = php_http_ztyp(IS_STRING, *tmp);
-                       if (IS_LONG == is_numeric_string(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy), &lval, NULL, 0)) {
+                       if (IS_LONG == is_numeric_string(lstr->val, lstr->len, &lval, NULL, 0)) {
                                list->expires = lval;
                        } else {
                                list->expires = lval;
                        } else {
-                               list->expires = php_parse_date(Z_STRVAL_P(cpy), NULL);
+                               list->expires = php_parse_date(lstr->val, NULL);
                        }
 
                        }
 
-                       zval_ptr_dtor(&cpy);
+                       zend_string_release(lstr);
                }
        }
                }
        }
-       if (SUCCESS == zend_hash_find(ht, "max-age", sizeof("max-age"), (void *) &tmp)) {
-               if (Z_TYPE_PP(tmp) == IS_LONG) {
-                       list->max_age = Z_LVAL_PP(tmp);
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("max-age")))) {
+               if (Z_TYPE_P(tmp) == IS_LONG) {
+                       list->max_age = Z_LVAL_P(tmp);
                } else {
                } else {
-                       long lval;
+                       zend_long lval;
+                       zend_string *lstr = zval_get_string(tmp);
 
 
-                       cpy = php_http_ztyp(IS_STRING, *tmp);
-                       if (IS_LONG == is_numeric_string(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy), &lval, NULL, 0)) {
+                       if (IS_LONG == is_numeric_string(lstr->val, lstr->len, &lval, NULL, 0)) {
                                list->max_age = lval;
                        }
 
                                list->max_age = lval;
                        }
 
-                       zval_ptr_dtor(&cpy);
+                       zend_string_release(lstr);
                }
        }
                }
        }
-       if (SUCCESS == zend_hash_find(ht, "path", sizeof("path"), (void *) &tmp) && Z_TYPE_PP(tmp) == IS_STRING) {
-               list->path = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("path")))) {
+               zend_string *str = zval_get_string(tmp);
+
+               list->path = estrndup(str->val, str->len);
+               zend_string_release(str);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "domain", sizeof("domain"), (void *) &tmp) && Z_TYPE_PP(tmp) == IS_STRING) {
-               list->domain = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
+       if ((tmp = zend_hash_str_find(ht, ZEND_STRL("domain")))) {
+               zend_string *str = zval_get_string(tmp);
+
+               list->domain = estrndup(str->val, str->len);
+               zend_string_release(str);
        }
        
        return list;
        }
        
        return list;
@@ -287,40 +291,39 @@ php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t
 
 static inline void append_encoded(php_http_buffer_t *buf, const char *key, size_t key_len, const char *val, size_t val_len)
 {
 
 static inline void append_encoded(php_http_buffer_t *buf, const char *key, size_t key_len, const char *val, size_t val_len)
 {
-       char *enc_str[2];
-       int enc_len[2];
+       zend_string *enc_str[2];
        
        
-       enc_str[0] = php_raw_url_encode(key, key_len, &enc_len[0]);
-       enc_str[1] = php_raw_url_encode(val, val_len, &enc_len[1]);
+       enc_str[0] = php_raw_url_encode(key, key_len);
+       enc_str[1] = php_raw_url_encode(val, val_len);
        
        
-       php_http_buffer_append(buf, enc_str[0], enc_len[0]);
+       php_http_buffer_append(buf, enc_str[0]->val, enc_str[0]->len);
        php_http_buffer_appends(buf, "=");
        php_http_buffer_appends(buf, "=");
-       php_http_buffer_append(buf, enc_str[1], enc_len[1]);
+       php_http_buffer_append(buf, enc_str[1]->val, enc_str[1]->len);
        php_http_buffer_appends(buf, "; ");
        
        php_http_buffer_appends(buf, "; ");
        
-       efree(enc_str[0]);
-       efree(enc_str[1]);
+       zend_string_release(enc_str[0]);
+       zend_string_release(enc_str[1]);
 }
 
 void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, size_t *len)
 {
        php_http_buffer_t buf;
 }
 
 void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, size_t *len)
 {
        php_http_buffer_t buf;
-       zval **val;
-       php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-       HashPosition pos;
-       TSRMLS_FETCH_FROM_CTX(list->ts);
+       zend_hash_key key;
+       zval *val;
        
        php_http_buffer_init(&buf);
        
        php_http_buffer_init(&buf);
-       
-       FOREACH_HASH_KEYVAL(pos, &list->cookies, key, val) {
-               zval *tmp = php_http_ztyp(IS_STRING, *val);
 
 
-               php_http_array_hashkey_stringify(&key);
-               append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
-               php_http_array_hashkey_stringfree(&key);
+       ZEND_HASH_FOREACH_KEY_VAL(&list->cookies, key.h, key.key, val)
+       {
+               zend_string *str = zval_get_string(val);
+               php_http_arrkey_t arrkey = {0};
 
 
-               zval_ptr_dtor(&tmp);
+               php_http_arrkey_stringify(&arrkey, &key);
+               append_encoded(&buf, arrkey.key->val, arrkey.key->len, str->val, str->len);
+               php_http_arrkey_dtor(&arrkey);
+               zend_string_release(str);
        }
        }
+       ZEND_HASH_FOREACH_END();
        
        if (list->domain && *list->domain) {
                php_http_buffer_appendf(&buf, "domain=%s; ", list->domain);
        
        if (list->domain && *list->domain) {
                php_http_buffer_appendf(&buf, "domain=%s; ", list->domain);
@@ -329,23 +332,25 @@ void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, si
                php_http_buffer_appendf(&buf, "path=%s; ", list->path);
        }
        if (list->expires >= 0) {
                php_http_buffer_appendf(&buf, "path=%s; ", list->path);
        }
        if (list->expires >= 0) {
-               char *date = php_format_date(ZEND_STRL(PHP_HTTP_DATE_FORMAT), list->expires, 0 TSRMLS_CC);
-               php_http_buffer_appendf(&buf, "expires=%s; ", date);
-               efree(date);
+               zend_string *date = php_format_date(ZEND_STRL(PHP_HTTP_DATE_FORMAT), list->expires, 0);
+               php_http_buffer_appendf(&buf, "expires=%s; ", date->val);
+               zend_string_release(date);
        }
        if (list->max_age >= 0) {
                php_http_buffer_appendf(&buf, "max-age=%ld; ", list->max_age);
        }
        
        }
        if (list->max_age >= 0) {
                php_http_buffer_appendf(&buf, "max-age=%ld; ", list->max_age);
        }
        
-       FOREACH_HASH_KEYVAL(pos, &list->extras, key, val) {
-               zval *tmp = php_http_ztyp(IS_STRING, *val);
-
-               php_http_array_hashkey_stringify(&key);
-               append_encoded(&buf, key.str, key.len-1, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
-               php_http_array_hashkey_stringfree(&key);
-
-               zval_ptr_dtor(&tmp);
+       ZEND_HASH_FOREACH_KEY_VAL(&list->extras, key.h, key.key, val)
+       {
+               zend_string *str = zval_get_string(val);
+               php_http_arrkey_t arrkey;
+
+               php_http_arrkey_stringify(&arrkey, &key);
+               append_encoded(&buf, arrkey.key->val, arrkey.key->len, str->val, str->len);
+               php_http_arrkey_dtor(&arrkey);
+               zend_string_release(str);
        }
        }
+       ZEND_HASH_FOREACH_END();
        
        if (list->flags & PHP_HTTP_COOKIE_SECURE) {
                php_http_buffer_appends(&buf, "secure; ");
        
        if (list->flags & PHP_HTTP_COOKIE_SECURE) {
                php_http_buffer_appends(&buf, "secure; ");
@@ -363,60 +368,56 @@ void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, si
 
 static zend_object_handlers php_http_cookie_object_handlers;
 
 
 static zend_object_handlers php_http_cookie_object_handlers;
 
-zend_object_value php_http_cookie_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_cookie_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_cookie_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_cookie_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list, php_http_cookie_object_t **ptr TSRMLS_DC)
+php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list)
 {
        php_http_cookie_object_t *o;
 
 {
        php_http_cookie_object_t *o;
 
-       o = ecalloc(sizeof(*o), 1);
-       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
+       if (!ce) {
+               ce = php_http_cookie_class_entry;
+       }
+
+       o = ecalloc(sizeof(*o) + sizeof(zval) * (ce->default_properties_count - 1), 1);
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
+       o->zo.handlers = &php_http_cookie_object_handlers;
 
        if (list) {
                o->list = list;
        }
 
 
        if (list) {
                o->list = list;
        }
 
-       if (ptr) {
-               *ptr = o;
-       }
-
-       o->zv.handle = zend_objects_store_put(o, NULL, php_http_cookie_object_free, NULL TSRMLS_CC);
-       o->zv.handlers = &php_http_cookie_object_handlers;
-
-       return o->zv;
+       return o;
 }
 
 #define PHP_HTTP_COOKIE_OBJECT_INIT(obj) \
        do { \
                if (!obj->list) { \
 }
 
 #define PHP_HTTP_COOKIE_OBJECT_INIT(obj) \
        do { \
                if (!obj->list) { \
-                       obj->list = php_http_cookie_list_init(NULL TSRMLS_CC); \
+                       obj->list = php_http_cookie_list_init(NULL); \
                } \
        } while(0)
 
                } \
        } while(0)
 
-zend_object_value php_http_cookie_object_clone(zval *this_ptr TSRMLS_DC)
+zend_object *php_http_cookie_object_clone(zval *obj)
 {
 {
-       php_http_cookie_object_t *new_obj, *old_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-       zend_object_value ov;
+       php_http_cookie_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(NULL, obj);
 
        PHP_HTTP_COOKIE_OBJECT_INIT(old_obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(old_obj);
 
-       ov = php_http_cookie_object_new_ex(old_obj->zo.ce, php_http_cookie_list_copy(old_obj->list, NULL), &new_obj TSRMLS_CC);
-       zend_objects_clone_members((zend_object *) new_obj, ov, (zend_object *) old_obj, Z_OBJ_HANDLE_P(getThis()) TSRMLS_CC);
+       new_obj = php_http_cookie_object_new_ex(old_obj->zo.ce, php_http_cookie_list_copy(old_obj->list, NULL));
+       zend_objects_clone_members(&new_obj->zo, &old_obj->zo);
 
 
-       return ov;
+       return &new_obj->zo;
 }
 
 }
 
-void php_http_cookie_object_free(void *object TSRMLS_DC)
+void php_http_cookie_object_free(zend_object *object TSRMLS_DC)
 {
 {
-       php_http_cookie_object_t *obj = object;
+       php_http_cookie_object_t *obj = PHP_HTTP_OBJ(object, NULL);
 
        php_http_cookie_list_free(&obj->list);
 
        php_http_cookie_list_free(&obj->list);
-       zend_object_std_dtor((zend_object *) obj TSRMLS_CC);
-       efree(obj);
+       zend_object_std_dtor(object);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie___construct, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie___construct, 0, 0, 0)
@@ -433,32 +434,33 @@ static PHP_METHOD(HttpCookie, __construct)
        HashTable *allowed_extras = NULL;
        zend_error_handling zeh;
 
        HashTable *allowed_extras = NULL;
        zend_error_handling zeh;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!lH", &zcookie, &flags, &allowed_extras), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z!lH", &zcookie, &flags, &allowed_extras), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_runtime_class_entry, &zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_runtime_class_entry, &zeh);
        if (zcookie) {
 
                if (allowed_extras && zend_hash_num_elements(allowed_extras)) {
                        char **ae_ptr = safe_emalloc(zend_hash_num_elements(allowed_extras) + 1, sizeof(char *), 0);
        if (zcookie) {
 
                if (allowed_extras && zend_hash_num_elements(allowed_extras)) {
                        char **ae_ptr = safe_emalloc(zend_hash_num_elements(allowed_extras) + 1, sizeof(char *), 0);
-                       HashPosition pos;
-                       zval **val;
+                       zval *val;
 
                        ae = ae_ptr;
 
                        ae = ae_ptr;
-                       FOREACH_HASH_VAL(pos, allowed_extras, val) {
-                               zval *cpy = php_http_ztyp(IS_STRING, *val);
+                       ZEND_HASH_FOREACH_VAL(allowed_extras, val)
+                       {
+                               zend_string *str = zval_get_string(val);
 
 
-                               *ae_ptr++ = estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy));
-                               zval_ptr_dtor(&cpy);
+                               *ae_ptr++ = estrndup(str->val, str->len);
+                               zend_string_release(str);
                        }
                        }
+                       ZEND_HASH_FOREACH_END();
                        *ae_ptr = NULL;
                }
 
                switch (Z_TYPE_P(zcookie)) {
                        case IS_OBJECT:
                        *ae_ptr = NULL;
                }
 
                switch (Z_TYPE_P(zcookie)) {
                        case IS_OBJECT:
-                               if (instanceof_function(Z_OBJCE_P(zcookie), php_http_cookie_class_entry TSRMLS_CC)) {
-                                       php_http_cookie_object_t *zco = zend_object_store_get_object(zcookie TSRMLS_CC);
+                               if (instanceof_function(Z_OBJCE_P(zcookie), php_http_cookie_class_entry)) {
+                                       php_http_cookie_object_t *zco = PHP_HTTP_OBJ(NULL, zcookie);
 
                                        if (zco->list) {
                                                obj->list = php_http_cookie_list_copy(zco->list, NULL);
 
                                        if (zco->list) {
                                                obj->list = php_http_cookie_list_copy(zco->list, NULL);
@@ -467,13 +469,13 @@ static PHP_METHOD(HttpCookie, __construct)
                                }
                                /* no break */
                        case IS_ARRAY:
                                }
                                /* no break */
                        case IS_ARRAY:
-                               obj->list = php_http_cookie_list_from_struct(obj->list, zcookie TSRMLS_CC);
+                               obj->list = php_http_cookie_list_from_struct(obj->list, zcookie);
                                break;
                        default: {
                                break;
                        default: {
-                               zval *cpy = php_http_ztyp(IS_STRING, zcookie);
+                               zend_string *str = zval_get_string(zcookie);
 
 
-                               obj->list = php_http_cookie_list_parse(obj->list, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy), flags, ae TSRMLS_CC);
-                               zval_ptr_dtor(&cpy);
+                               obj->list = php_http_cookie_list_parse(obj->list, str->val, str->len, flags, ae);
+                               zend_string_release(str);
                                break;
                        }
                }
                                break;
                        }
                }
@@ -487,7 +489,7 @@ static PHP_METHOD(HttpCookie, __construct)
                        efree(ae);
                }
        }
                        efree(ae);
                }
        }
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_restore_error_handling(&zeh);
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 }
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 }
@@ -502,11 +504,11 @@ static PHP_METHOD(HttpCookie, getCookies)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
-       array_init(return_value);
+       array_init_size(return_value, zend_hash_num_elements(&obj->list->cookies));
        array_copy(&obj->list->cookies, Z_ARRVAL_P(return_value));
 }
 
        array_copy(&obj->list->cookies, Z_ARRVAL_P(return_value));
 }
 
@@ -518,9 +520,9 @@ static PHP_METHOD(HttpCookie, setCookies)
        HashTable *cookies = NULL;
        php_http_cookie_object_t *obj;
 
        HashTable *cookies = NULL;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|H", &cookies), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &cookies), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -529,7 +531,7 @@ static PHP_METHOD(HttpCookie, setCookies)
                array_copy_strings(cookies, &obj->list->cookies);
        }
 
                array_copy_strings(cookies, &obj->list->cookies);
        }
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETURN_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookies, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookies, 0, 0, 1)
@@ -540,15 +542,15 @@ static PHP_METHOD(HttpCookie, addCookies)
        HashTable *cookies = NULL;
        php_http_cookie_object_t *obj;
 
        HashTable *cookies = NULL;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &cookies), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "H", &cookies), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        array_join(cookies, &obj->list->cookies, 1, ARRAY_JOIN_STRONLY|ARRAY_JOIN_STRINGIFY);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        array_join(cookies, &obj->list->cookies, 1, ARRAY_JOIN_STRONLY|ARRAY_JOIN_STRINGIFY);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtras, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtras, 0, 0, 0)
@@ -561,11 +563,11 @@ static PHP_METHOD(HttpCookie, getExtras)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
-       array_init(return_value);
+       array_init_size(return_value, zend_hash_num_elements(&obj->list->extras));
        array_copy(&obj->list->extras, Z_ARRVAL_P(return_value));
 }
 
        array_copy(&obj->list->extras, Z_ARRVAL_P(return_value));
 }
 
@@ -577,9 +579,9 @@ static PHP_METHOD(HttpCookie, setExtras)
        HashTable *extras = NULL;
        php_http_cookie_object_t *obj;
 
        HashTable *extras = NULL;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|H", &extras), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &extras), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -588,7 +590,7 @@ static PHP_METHOD(HttpCookie, setExtras)
                array_copy_strings(extras, &obj->list->extras);
        }
 
                array_copy_strings(extras, &obj->list->extras);
        }
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtras, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtras, 0, 0, 1)
@@ -599,15 +601,15 @@ static PHP_METHOD(HttpCookie, addExtras)
        HashTable *extras = NULL;
        php_http_cookie_object_t *obj;
 
        HashTable *extras = NULL;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &extras), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "H", &extras), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        array_join(extras, &obj->list->extras, 1, ARRAY_JOIN_STRONLY|ARRAY_JOIN_STRINGIFY);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        array_join(extras, &obj->list->extras, 1, ARRAY_JOIN_STRONLY|ARRAY_JOIN_STRINGIFY);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getCookie, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getCookie, 0, 0, 1)
@@ -616,20 +618,20 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, getCookie)
 {
        char *name_str;
 static PHP_METHOD(HttpCookie, getCookie)
 {
        char *name_str;
-       int name_len;
-       zval *zvalue;
+       size_t name_len;
+       zval zvalue;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len)) {
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (php_http_cookie_list_get_cookie(obj->list, name_str, name_len, &zvalue)) {
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (php_http_cookie_list_get_cookie(obj->list, name_str, name_len, &zvalue)) {
-               RETURN_ZVAL(zvalue, 1, 0);
+               RETURN_ZVAL_FAST(&zvalue);
        }
 }
 
        }
 }
 
@@ -640,12 +642,12 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setCookie)
 {
        char *name_str, *value_str = NULL;
 static PHP_METHOD(HttpCookie, setCookie)
 {
        char *name_str, *value_str = NULL;
-       int name_len, value_len = 0;
+       size_t name_len, value_len = 0;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -655,7 +657,7 @@ static PHP_METHOD(HttpCookie, setCookie)
                php_http_cookie_list_add_cookie(obj->list, name_str, name_len, value_str, value_len);
        }
 
                php_http_cookie_list_add_cookie(obj->list, name_str, name_len, value_str, value_len);
        }
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookie, 0, 0, 2)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookie, 0, 0, 2)
@@ -665,18 +667,18 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, addCookie)
 {
        char *name_str, *value_str;
 static PHP_METHOD(HttpCookie, addCookie)
 {
        char *name_str, *value_str;
-       int name_len, value_len;
+       size_t name_len, value_len;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_add_cookie(obj->list, name_str, name_len, value_str, value_len);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_add_cookie(obj->list, name_str, name_len, value_str, value_len);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtra, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtra, 0, 0, 1)
@@ -685,20 +687,20 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, getExtra)
 {
        char *name_str;
 static PHP_METHOD(HttpCookie, getExtra)
 {
        char *name_str;
-       int name_len;
-       zval *zvalue;
+       size_t name_len;
+       zval zvalue;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len)) {
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (php_http_cookie_list_get_extra(obj->list, name_str, name_len, &zvalue)) {
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (php_http_cookie_list_get_extra(obj->list, name_str, name_len, &zvalue)) {
-               RETURN_ZVAL(zvalue, 1, 0);
+               RETURN_ZVAL_FAST(&zvalue);
        }
 }
 
        }
 }
 
@@ -709,12 +711,12 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setExtra)
 {
        char *name_str, *value_str = NULL;
 static PHP_METHOD(HttpCookie, setExtra)
 {
        char *name_str, *value_str = NULL;
-       int name_len, value_len = 0;
+       size_t name_len, value_len = 0;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -724,7 +726,7 @@ static PHP_METHOD(HttpCookie, setExtra)
                php_http_cookie_list_add_extra(obj->list, name_str, name_len, value_str, value_len);
        }
 
                php_http_cookie_list_add_extra(obj->list, name_str, name_len, value_str, value_len);
        }
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtra, 0, 0, 2)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtra, 0, 0, 2)
@@ -734,18 +736,18 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, addExtra)
 {
        char *name_str, *value_str;
 static PHP_METHOD(HttpCookie, addExtra)
 {
        char *name_str, *value_str;
-       int name_len, value_len;
+       size_t name_len, value_len;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_add_extra(obj->list, name_str, name_len, value_str, value_len);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_add_extra(obj->list, name_str, name_len, value_str, value_len);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getDomain, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getDomain, 0, 0, 0)
@@ -758,12 +760,12 @@ static PHP_METHOD(HttpCookie, getDomain)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (obj->list->domain) {
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (obj->list->domain) {
-               RETURN_STRING(obj->list->domain, 1);
+               RETURN_STRING(obj->list->domain);
        }
 }
 
        }
 }
 
@@ -773,18 +775,18 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setDomain)
 {
        char *domain_str = NULL;
 static PHP_METHOD(HttpCookie, setDomain)
 {
        char *domain_str = NULL;
-       int domain_len = 0;
+       size_t domain_len = 0;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &domain_str, &domain_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &domain_str, &domain_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        PTR_SET(obj->list->domain, domain_str ? estrndup(domain_str, domain_len) : NULL);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        PTR_SET(obj->list->domain, domain_str ? estrndup(domain_str, domain_len) : NULL);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getPath, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getPath, 0, 0, 0)
@@ -797,12 +799,12 @@ static PHP_METHOD(HttpCookie, getPath)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (obj->list->path) {
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        if (obj->list->path) {
-               RETURN_STRING(obj->list->path, 1);
+               RETURN_STRING(obj->list->path);
        }
 }
 
        }
 }
 
@@ -812,18 +814,18 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setPath)
 {
        char *path_str = NULL;
 static PHP_METHOD(HttpCookie, setPath)
 {
        char *path_str = NULL;
-       int path_len = 0;
+       size_t path_len = 0;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &path_str, &path_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &path_str, &path_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        PTR_SET(obj->list->path, path_str ? estrndup(path_str, path_len) : NULL);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        PTR_SET(obj->list->path, path_str ? estrndup(path_str, path_len) : NULL);
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExpires, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExpires, 0, 0, 0)
@@ -836,7 +838,7 @@ static PHP_METHOD(HttpCookie, getExpires)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -851,15 +853,15 @@ static PHP_METHOD(HttpCookie, setExpires)
        long ts = -1;
        php_http_cookie_object_t *obj;
 
        long ts = -1;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        obj->list->expires = ts;
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        obj->list->expires = ts;
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getMaxAge, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getMaxAge, 0, 0, 0)
@@ -872,7 +874,7 @@ static PHP_METHOD(HttpCookie, getMaxAge)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -884,18 +886,18 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setMaxAge, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setMaxAge)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpCookie, setMaxAge)
 {
-       long ts = -1;
+       long ma = -1;
        php_http_cookie_object_t *obj;
 
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &ts), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ma), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
-       obj->list->max_age = ts;
+       obj->list->max_age = ma;
 
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getFlags, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getFlags, 0, 0, 0)
@@ -908,7 +910,7 @@ static PHP_METHOD(HttpCookie, getFlags)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
@@ -925,13 +927,13 @@ static PHP_METHOD(HttpCookie, setFlags)
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        obj->list->flags = flags;
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        obj->list->flags = flags;
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toString, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toString, 0, 0, 0)
@@ -946,13 +948,13 @@ static PHP_METHOD(HttpCookie, toString)
                RETURN_EMPTY_STRING();
        }
 
                RETURN_EMPTY_STRING();
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_to_string(obj->list, &str, &len);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
        php_http_cookie_list_to_string(obj->list, &str, &len);
 
-       RETURN_STRINGL(str, len, 0);
+       RETURN_NEW_STR(php_http_cs2zs(str, len));
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toArray, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toArray, 0, 0, 0)
@@ -965,11 +967,11 @@ static PHP_METHOD(HttpCookie, toArray)
                return;
        }
 
                return;
        }
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_COOKIE_OBJECT_INIT(obj);
 
-       array_init(return_value);
+       array_init_size(return_value, 8);
        php_http_cookie_list_to_struct(obj->list, return_value);
 }
 
        php_http_cookie_list_to_struct(obj->list, return_value);
 }
 
@@ -1014,10 +1016,12 @@ PHP_MINIT_FUNCTION(http_cookie)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Cookie", php_http_cookie_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Cookie", php_http_cookie_methods);
-       php_http_cookie_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_cookie_class_entry = zend_register_internal_class(&ce);
        php_http_cookie_class_entry->create_object = php_http_cookie_object_new;
        memcpy(&php_http_cookie_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_cookie_class_entry->create_object = php_http_cookie_object_new;
        memcpy(&php_http_cookie_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+       php_http_cookie_object_handlers.offset = XtOffsetOf(php_http_cookie_object_t, zo);
        php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone;
        php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone;
+       php_http_cookie_object_handlers.dtor_obj = php_http_cookie_object_free;
 
        zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW TSRMLS_CC);
        zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE TSRMLS_CC);
 
        zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW TSRMLS_CC);
        zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE TSRMLS_CC);
index 7cf00fe2c75d4c0c5d283a229abf69e2d0561588..9e63cbe39e242c84a826498375d94a34abb07650 100644 (file)
@@ -31,44 +31,39 @@ typedef struct php_http_cookie_list {
        char *domain;
        time_t expires;
        time_t max_age;
        char *domain;
        time_t expires;
        time_t max_age;
-
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_cookie_list_t;
 
 } php_http_cookie_list_t;
 
-PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list TSRMLS_DC);
-PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t *list, const char *str, size_t len, long flags, char **allowed_extras TSRMLS_DC);
+PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_init(php_http_cookie_list_t *list);
+PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_parse(php_http_cookie_list_t *list, const char *str, size_t len, long flags, char **allowed_extras);
 PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_copy(php_http_cookie_list_t *from, php_http_cookie_list_t *to);
 PHP_HTTP_API void php_http_cookie_list_dtor(php_http_cookie_list_t *list);
 PHP_HTTP_API void php_http_cookie_list_free(php_http_cookie_list_t **list);
 
 PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_copy(php_http_cookie_list_t *from, php_http_cookie_list_t *to);
 PHP_HTTP_API void php_http_cookie_list_dtor(php_http_cookie_list_t *list);
 PHP_HTTP_API void php_http_cookie_list_free(php_http_cookie_list_t **list);
 
-#define php_http_cookie_list_has_cookie(list, name, name_len) zend_symtable_exists(&(list)->cookies, (name), (name_len)+1)
-#define php_http_cookie_list_del_cookie(list, name, name_len) zend_symtable_del(&(list)->cookies, (name), (name_len)+1)
+#define php_http_cookie_list_has_cookie(list, name, name_len) zend_symtable_str_exists(&(list)->cookies, (name), (name_len))
+#define php_http_cookie_list_del_cookie(list, name, name_len) zend_symtable_str_del(&(list)->cookies, (name), (name_len))
 PHP_HTTP_API void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
 PHP_HTTP_API void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
-PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, zval **cookie);
+PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, zval *cookie);
 
 
-#define php_http_cookie_list_has_extra(list, name, name_len) zend_symtable_exists(&(list)->extras, (name), (name_len)+1)
-#define php_http_cookie_list_del_extra(list, name, name_len) zend_symtable_del(&(list)->extras, (name), (name_len)+1)
+#define php_http_cookie_list_has_extra(list, name, name_len) zend_symtable_str_exists(&(list)->extras, (name), (name_len))
+#define php_http_cookie_list_del_extra(list, name, name_len) zend_symtable_str_del(&(list)->extras, (name), (name_len))
 PHP_HTTP_API void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
 PHP_HTTP_API void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
-PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, zval **extra);
+PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, zval *extra);
 
 PHP_HTTP_API void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, size_t *len);
 
 PHP_HTTP_API void php_http_cookie_list_to_string(php_http_cookie_list_t *list, char **str, size_t *len);
-PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC);
+PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct);
 PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct);
 
 PHP_HTTP_API zend_class_entry *php_http_cookie_class_entry;
 
 typedef struct php_http_cookie_object {
 PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct);
 
 PHP_HTTP_API zend_class_entry *php_http_cookie_class_entry;
 
 typedef struct php_http_cookie_object {
-       zend_object zo;
-       zend_object_value zv;
        php_http_cookie_list_t *list;
        php_http_cookie_list_t *list;
+       zend_object zo;
 } php_http_cookie_object_t;
 
 } php_http_cookie_object_t;
 
-zend_object_value php_http_cookie_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list, php_http_cookie_object_t **obj TSRMLS_DC);
-zend_object_value php_http_cookie_object_clone(zval *this_ptr TSRMLS_DC);
-void php_http_cookie_object_free(void *object TSRMLS_DC);
+zend_object *php_http_cookie_object_new(zend_class_entry *ce);
+php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list);
+zend_object *php_http_cookie_object_clone(zval *this_ptr);
+void php_http_cookie_object_free(zend_object *object TSRMLS_DC);
 
 PHP_MINIT_FUNCTION(http_cookie);
 
 
 PHP_MINIT_FUNCTION(http_cookie);
 
index b7050f6d769e737984bcddee1fd45996c0c3d179..a6e9337cdbe8827db2e7bc67311af193cf3d0a83 100644 (file)
@@ -28,7 +28,7 @@ static inline int eol_match(char **line, int *eol_len)
        }
 }
 
        }
 }
 
-const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len TSRMLS_DC)
+const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len)
 {
        int eol_len = 0;
        char *n_ptr = NULL;
 {
        int eol_len = 0;
        char *n_ptr = NULL;
@@ -50,13 +50,13 @@ const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, c
                         * not encoded data and return a copy
                         */
                        if (e_ptr == encoded) {
                         * not encoded data and return a copy
                         */
                        if (e_ptr == encoded) {
-                               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Data does not seem to be chunked encoded");
+                               php_error_docref(NULL, E_NOTICE, "Data does not seem to be chunked encoded");
                                memcpy(*decoded, encoded, encoded_len);
                                *decoded_len = encoded_len;
                                return encoded + encoded_len;
                        } else {
                                efree(*decoded);
                                memcpy(*decoded, encoded, encoded_len);
                                *decoded_len = encoded_len;
                                return encoded + encoded_len;
                        } else {
                                efree(*decoded);
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected chunk size at pos %tu of %zu but got trash", n_ptr - encoded, encoded_len);
+                               php_error_docref(NULL, E_WARNING, "Expected chunk size at pos %tu of %zu but got trash", n_ptr - encoded, encoded_len);
                                return NULL;
                        }
                }
                                return NULL;
                        }
                }
@@ -79,16 +79,16 @@ const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, c
                /* there should be CRLF after the chunk size, but we'll ignore SP+ too */
                if (*n_ptr && !eol_match(&n_ptr, &eol_len)) {
                        if (eol_len == 2) {
                /* there should be CRLF after the chunk size, but we'll ignore SP+ too */
                if (*n_ptr && !eol_match(&n_ptr, &eol_len)) {
                        if (eol_len == 2) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected CRLF at pos %tu of %zu but got 0x%02X 0x%02X", n_ptr - encoded, encoded_len, *n_ptr, *(n_ptr + 1));
+                               php_error_docref(NULL, E_WARNING, "Expected CRLF at pos %tu of %zu but got 0x%02X 0x%02X", n_ptr - encoded, encoded_len, *n_ptr, *(n_ptr + 1));
                        } else {
                        } else {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected LF at pos %tu of %zu but got 0x%02X", n_ptr - encoded, encoded_len, *n_ptr);
+                               php_error_docref(NULL, E_WARNING, "Expected LF at pos %tu of %zu but got 0x%02X", n_ptr - encoded, encoded_len, *n_ptr);
                        }
                }
                n_ptr += eol_len;
                
                /* chunk size pretends more data than we actually got, so it's probably a truncated message */
                if (chunk_len > (rest = encoded + encoded_len - n_ptr)) {
                        }
                }
                n_ptr += eol_len;
                
                /* chunk size pretends more data than we actually got, so it's probably a truncated message */
                if (chunk_len > (rest = encoded + encoded_len - n_ptr)) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Truncated message: chunk size %lu exceeds remaining data size %lu at pos %tu of %zu", chunk_len, rest, n_ptr - encoded, encoded_len);
+                       php_error_docref(NULL, E_WARNING, "Truncated message: chunk size %lu exceeds remaining data size %lu at pos %tu of %zu", chunk_len, rest, n_ptr - encoded, encoded_len);
                        chunk_len = rest;
                }
 
                        chunk_len = rest;
                }
 
@@ -148,7 +148,7 @@ static inline int php_http_inflate_rounds(z_stream *Z, int flush, char **buf, si
        return status;
 }
 
        return status;
 }
 
-STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len)
 {
        int status, level, wbits, strategy;
        z_stream Z;
 {
        int status, level, wbits, strategy;
        z_stream Z;
@@ -185,11 +185,11 @@ STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, c
                }
        }
        
                }
        }
        
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not deflate data: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Could not deflate data: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-STATUS php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len)
 {
        z_stream Z;
        int status, wbits = PHP_HTTP_WINDOW_BITS_ANY;
 {
        z_stream Z;
        int status, wbits = PHP_HTTP_WINDOW_BITS_ANY;
@@ -227,11 +227,11 @@ retry_raw_inflate:
                }
        }
        
                }
        }
        
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not inflate data: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Could not inflate data: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags TSRMLS_DC)
+php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags)
 {
        int freeme;
 
 {
        int freeme;
 
@@ -241,7 +241,6 @@ php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stre
        memset(s, 0, sizeof(*s));
 
        s->flags = flags;
        memset(s, 0, sizeof(*s));
 
        s->flags = flags;
-       TSRMLS_SET_CTX(s->ts);
 
        if ((s->ops = ops)) {
                php_http_encoding_stream_t *ss = s->ops->init(s);
 
        if ((s->ops = ops)) {
                php_http_encoding_stream_t *ss = s->ops->init(s);
@@ -261,8 +260,6 @@ php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stre
 
 php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to)
 {
 
 php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to)
 {
-       TSRMLS_FETCH_FROM_CTX(from->ts);
-
        if (from->ops->copy) {
                int freeme;
                php_http_encoding_stream_t *ns;
        if (from->ops->copy) {
                int freeme;
                php_http_encoding_stream_t *ns;
@@ -274,7 +271,6 @@ php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stre
 
                to->flags = from->flags;
                to->ops = from->ops;
 
                to->flags = from->flags;
                to->ops = from->ops;
-               TSRMLS_SET_CTX(to->ts);
 
                if ((ns = to->ops->copy(from, to))) {
                        return ns;
 
                if ((ns = to->ops->copy(from, to))) {
                        return ns;
@@ -290,9 +286,10 @@ php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stre
        return NULL;
 }
 
        return NULL;
 }
 
-STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s)
+ZEND_RESULT_CODE php_http_encoding_stream_reset(php_http_encoding_stream_t **s)
 {
        php_http_encoding_stream_t *ss;
 {
        php_http_encoding_stream_t *ss;
+
        if ((*s)->ops->dtor) {
                (*s)->ops->dtor(*s);
        }
        if ((*s)->ops->dtor) {
                (*s)->ops->dtor(*s);
        }
@@ -303,7 +300,7 @@ STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s)
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len)
+ZEND_RESULT_CODE php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len)
 {
        if (!s->ops->update) {
                return FAILURE;
 {
        if (!s->ops->update) {
                return FAILURE;
@@ -311,7 +308,7 @@ STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char
        return s->ops->update(s, in_str, in_len, out_str, out_len);
 }
 
        return s->ops->update(s, in_str, in_len, out_str, out_len);
 }
 
-STATUS php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *out_len)
+ZEND_RESULT_CODE php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *out_len)
 {
        if (!s->ops->flush) {
                *out_str = NULL;
 {
        if (!s->ops->flush) {
                *out_str = NULL;
@@ -329,7 +326,7 @@ zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s)
        return s->ops->done(s);
 }
 
        return s->ops->done(s);
 }
 
-STATUS php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *out_len)
+ZEND_RESULT_CODE php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *out_len)
 {
        if (!s->ops->finish) {
                *out_str = NULL;
 {
        if (!s->ops->finish) {
                *out_str = NULL;
@@ -367,7 +364,6 @@ static php_http_encoding_stream_t *deflate_init(php_http_encoding_stream_t *s)
 {
        int status, level, wbits, strategy, p = (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT);
        z_streamp ctx = pecalloc(1, sizeof(z_stream), p);
 {
        int status, level, wbits, strategy, p = (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT);
        z_streamp ctx = pecalloc(1, sizeof(z_stream), p);
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        PHP_HTTP_DEFLATE_LEVEL_SET(s->flags, level);
        PHP_HTTP_DEFLATE_WBITS_SET(s->flags, wbits);
        
        PHP_HTTP_DEFLATE_LEVEL_SET(s->flags, level);
        PHP_HTTP_DEFLATE_WBITS_SET(s->flags, wbits);
@@ -382,7 +378,7 @@ static php_http_encoding_stream_t *deflate_init(php_http_encoding_stream_t *s)
                status = Z_MEM_ERROR;
        }
        pefree(ctx, p);
                status = Z_MEM_ERROR;
        }
        pefree(ctx, p);
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to initialize deflate encoding stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to initialize deflate encoding stream: %s", zError(status));
        return NULL;
 }
 
        return NULL;
 }
 
@@ -390,7 +386,6 @@ static php_http_encoding_stream_t *inflate_init(php_http_encoding_stream_t *s)
 {
        int status, wbits, p = (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT);
        z_streamp ctx = pecalloc(1, sizeof(z_stream), p);
 {
        int status, wbits, p = (s->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT);
        z_streamp ctx = pecalloc(1, sizeof(z_stream), p);
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        PHP_HTTP_INFLATE_WBITS_SET(s->flags, wbits);
        
        
        PHP_HTTP_INFLATE_WBITS_SET(s->flags, wbits);
        
@@ -403,7 +398,7 @@ static php_http_encoding_stream_t *inflate_init(php_http_encoding_stream_t *s)
                status = Z_MEM_ERROR;
        }
        pefree(ctx, p);
                status = Z_MEM_ERROR;
        }
        pefree(ctx, p);
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to initialize inflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to initialize inflate stream: %s", zError(status));
        return NULL;
 }
 
        return NULL;
 }
 
@@ -426,7 +421,6 @@ static php_http_encoding_stream_t *deflate_copy(php_http_encoding_stream_t *from
 {
        int status, p = to->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        z_streamp from_ctx = from->ctx, to_ctx = pecalloc(1, sizeof(*to_ctx), p);
 {
        int status, p = to->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        z_streamp from_ctx = from->ctx, to_ctx = pecalloc(1, sizeof(*to_ctx), p);
-       TSRMLS_FETCH_FROM_CTX(from->ts);
 
        if (Z_OK == (status = deflateCopy(to_ctx, from_ctx))) {
                if ((to_ctx->opaque = php_http_buffer_init_ex(NULL, PHP_HTTP_DEFLATE_BUFFER_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0))) {
 
        if (Z_OK == (status = deflateCopy(to_ctx, from_ctx))) {
                if ((to_ctx->opaque = php_http_buffer_init_ex(NULL, PHP_HTTP_DEFLATE_BUFFER_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0))) {
@@ -437,7 +431,7 @@ static php_http_encoding_stream_t *deflate_copy(php_http_encoding_stream_t *from
                deflateEnd(to_ctx);
                status = Z_MEM_ERROR;
        }
                deflateEnd(to_ctx);
                status = Z_MEM_ERROR;
        }
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to copy deflate encoding stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to copy deflate encoding stream: %s", zError(status));
        return NULL;
 }
 
        return NULL;
 }
 
@@ -445,7 +439,6 @@ static php_http_encoding_stream_t *inflate_copy(php_http_encoding_stream_t *from
 {
        int status, p = from->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        z_streamp from_ctx = from->ctx, to_ctx = pecalloc(1, sizeof(*to_ctx), p);
 {
        int status, p = from->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        z_streamp from_ctx = from->ctx, to_ctx = pecalloc(1, sizeof(*to_ctx), p);
-       TSRMLS_FETCH_FROM_CTX(from->ts);
 
        if (Z_OK == (status = inflateCopy(to_ctx, from_ctx))) {
                if ((to_ctx->opaque = php_http_buffer_init_ex(NULL, PHP_HTTP_DEFLATE_BUFFER_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0))) {
 
        if (Z_OK == (status = inflateCopy(to_ctx, from_ctx))) {
                if ((to_ctx->opaque = php_http_buffer_init_ex(NULL, PHP_HTTP_DEFLATE_BUFFER_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0))) {
@@ -456,7 +449,7 @@ static php_http_encoding_stream_t *inflate_copy(php_http_encoding_stream_t *from
                inflateEnd(to_ctx);
                status = Z_MEM_ERROR;
        }
                inflateEnd(to_ctx);
                status = Z_MEM_ERROR;
        }
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to copy inflate encoding stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to copy inflate encoding stream: %s", zError(status));
        return NULL;
 }
 
        return NULL;
 }
 
@@ -464,7 +457,6 @@ static php_http_encoding_stream_t *dechunk_copy(php_http_encoding_stream_t *from
 {
        int p = from->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        struct dechunk_ctx *from_ctx = from->ctx, *to_ctx = pemalloc(sizeof(*to_ctx), p);
 {
        int p = from->flags & PHP_HTTP_ENCODING_STREAM_PERSISTENT;
        struct dechunk_ctx *from_ctx = from->ctx, *to_ctx = pemalloc(sizeof(*to_ctx), p);
-       TSRMLS_FETCH_FROM_CTX(from->ts);
 
        if (php_http_buffer_init_ex(&to_ctx->buffer, PHP_HTTP_BUFFER_DEFAULT_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0)) {
                to_ctx->hexlen = from_ctx->hexlen;
 
        if (php_http_buffer_init_ex(&to_ctx->buffer, PHP_HTTP_BUFFER_DEFAULT_SIZE, p ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0)) {
                to_ctx->hexlen = from_ctx->hexlen;
@@ -474,15 +466,14 @@ static php_http_encoding_stream_t *dechunk_copy(php_http_encoding_stream_t *from
                return to;
        }
        pefree(to_ctx, p);
                return to;
        }
        pefree(to_ctx, p);
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to copy inflate encoding stream: out of memory");
+       php_error_docref(NULL, E_WARNING, "Failed to copy inflate encoding stream: out of memory");
        return NULL;
 }
 
        return NULL;
 }
 
-static STATUS deflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **encoded, size_t *encoded_len)
+static ZEND_RESULT_CODE deflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **encoded, size_t *encoded_len)
 {
        int status;
        z_streamp ctx = s->ctx;
 {
        int status;
        z_streamp ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        /* append input to our buffer */
        php_http_buffer_append(PHP_HTTP_BUFFER(ctx->opaque), data, data_len);
        
        /* append input to our buffer */
        php_http_buffer_append(PHP_HTTP_BUFFER(ctx->opaque), data, data_len);
@@ -515,15 +506,14 @@ static STATUS deflate_update(php_http_encoding_stream_t *s, const char *data, si
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to update deflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to update deflate stream: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-static STATUS inflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len)
+static ZEND_RESULT_CODE inflate_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len)
 {
        int status;
        z_streamp ctx = s->ctx;
 {
        int status;
        z_streamp ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        /* append input to buffer */
        php_http_buffer_append(PHP_HTTP_BUFFER(ctx->opaque), data, data_len);
        
        /* append input to buffer */
        php_http_buffer_append(PHP_HTTP_BUFFER(ctx->opaque), data, data_len);
@@ -554,18 +544,17 @@ retry_raw_inflate:
                        break;
        }
        
                        break;
        }
        
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to update inflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to update inflate stream: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-static STATUS dechunk_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len)
+static ZEND_RESULT_CODE dechunk_update(php_http_encoding_stream_t *s, const char *data, size_t data_len, char **decoded, size_t *decoded_len)
 {
        php_http_buffer_t tmp;
        struct dechunk_ctx *ctx = s->ctx;
 {
        php_http_buffer_t tmp;
        struct dechunk_ctx *ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
 
        if (ctx->zeroed) {
 
        if (ctx->zeroed) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Dechunk encoding stream has already reached the end of chunked input");
+               php_error_docref(NULL, E_WARNING, "Dechunk encoding stream has already reached the end of chunked input");
                return FAILURE;
        }
        if ((PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(&ctx->buffer, data, data_len)) || !php_http_buffer_fix(&ctx->buffer)) {
                return FAILURE;
        }
        if ((PHP_HTTP_BUFFER_NOMEM == php_http_buffer_append(&ctx->buffer, data, data_len)) || !php_http_buffer_fix(&ctx->buffer)) {
@@ -686,11 +675,10 @@ static STATUS dechunk_update(php_http_encoding_stream_t *s, const char *data, si
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len)
+static ZEND_RESULT_CODE deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len)
 {
        int status;
        z_streamp ctx = s->ctx;
 {
        int status;
        z_streamp ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        *encoded_len = PHP_HTTP_DEFLATE_BUFFER_SIZE;
        *encoded = emalloc(*encoded_len);
        
        *encoded_len = PHP_HTTP_DEFLATE_BUFFER_SIZE;
        *encoded = emalloc(*encoded_len);
@@ -711,11 +699,11 @@ static STATUS deflate_flush(php_http_encoding_stream_t *s, char **encoded, size_
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to flush deflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to flush deflate stream: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-static STATUS dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len)
+static ZEND_RESULT_CODE dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len)
 {
        struct dechunk_ctx *ctx = s->ctx;
 
 {
        struct dechunk_ctx *ctx = s->ctx;
 
@@ -735,11 +723,10 @@ static STATUS dechunk_flush(php_http_encoding_stream_t *s, char **decoded, size_
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS deflate_finish(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len)
+static ZEND_RESULT_CODE deflate_finish(php_http_encoding_stream_t *s, char **encoded, size_t *encoded_len)
 {
        int status;
        z_streamp ctx = s->ctx;
 {
        int status;
        z_streamp ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        *encoded_len = PHP_HTTP_DEFLATE_BUFFER_SIZE;
        *encoded = emalloc(*encoded_len);
        
        *encoded_len = PHP_HTTP_DEFLATE_BUFFER_SIZE;
        *encoded = emalloc(*encoded_len);
@@ -768,15 +755,14 @@ static STATUS deflate_finish(php_http_encoding_stream_t *s, char **encoded, size
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
        
        PTR_SET(*encoded, NULL);
        *encoded_len = 0;
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to finish deflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to finish deflate stream: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
-static STATUS inflate_finish(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len)
+static ZEND_RESULT_CODE inflate_finish(php_http_encoding_stream_t *s, char **decoded, size_t *decoded_len)
 {
        int status;
        z_streamp ctx = s->ctx;
 {
        int status;
        z_streamp ctx = s->ctx;
-       TSRMLS_FETCH_FROM_CTX(s->ts);
        
        if (!PHP_HTTP_BUFFER(ctx->opaque)->used) {
                *decoded = NULL;
        
        if (!PHP_HTTP_BUFFER(ctx->opaque)->used) {
                *decoded = NULL;
@@ -807,7 +793,7 @@ static STATUS inflate_finish(php_http_encoding_stream_t *s, char **decoded, size
        
        PTR_SET(*decoded, NULL);
        *decoded_len = 0;
        
        PTR_SET(*decoded, NULL);
        *decoded_len = 0;
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to finish inflate stream: %s", zError(status));
+       php_error_docref(NULL, E_WARNING, "Failed to finish inflate stream: %s", zError(status));
        return FAILURE;
 }
 
        return FAILURE;
 }
 
@@ -914,53 +900,47 @@ php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void)
 
 static zend_object_handlers php_http_encoding_stream_object_handlers;
 
 
 static zend_object_handlers php_http_encoding_stream_object_handlers;
 
-zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_encoding_stream_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_encoding_stream_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_encoding_stream_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC)
+php_http_encoding_stream_object_t *php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s)
 {
        php_http_encoding_stream_object_t *o;
 
 {
        php_http_encoding_stream_object_t *o;
 
-       o = ecalloc(1, sizeof(*o));
-       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
-
-       if (ptr) {
-               *ptr = o;
-       }
+       o = ecalloc(1, sizeof(*o) + (ce->default_properties_count - 1) * sizeof(zval));
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
 
        if (s) {
                o->stream = s;
        }
 
 
        if (s) {
                o->stream = s;
        }
 
-       o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_encoding_stream_object_free, NULL TSRMLS_CC);
-       o->zv.handlers = &php_http_encoding_stream_object_handlers;
+       o->zo.handlers = &php_http_encoding_stream_object_handlers;
 
 
-       return o->zv;
+       return o;
 }
 
 }
 
-zend_object_value php_http_encoding_stream_object_clone(zval *this_ptr TSRMLS_DC)
+zend_object *php_http_encoding_stream_object_clone(zval *object)
 {
 {
-       zend_object_value new_ov;
-       php_http_encoding_stream_object_t *new_obj = NULL, *old_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_encoding_stream_object_t *new_obj = NULL, *old_obj = PHP_HTTP_OBJ(NULL, object);
+       php_http_encoding_stream_t *cpy = php_http_encoding_stream_copy(old_obj->stream, NULL);
 
 
-       new_ov = php_http_encoding_stream_object_new_ex(old_obj->zo.ce, php_http_encoding_stream_copy(old_obj->stream, NULL), &new_obj TSRMLS_CC);
-       zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+       new_obj = php_http_encoding_stream_object_new_ex(old_obj->zo.ce, cpy);
+       zend_objects_clone_members(&new_obj->zo, &old_obj->zo);
 
 
-       return new_ov;
+       return &new_obj->zo;
 }
 
 }
 
-void php_http_encoding_stream_object_free(void *object TSRMLS_DC)
+void php_http_encoding_stream_object_free(zend_object *object)
 {
 {
-       php_http_encoding_stream_object_t *o = (php_http_encoding_stream_object_t *) object;
+       php_http_encoding_stream_object_t *o = PHP_HTTP_OBJ(object, NULL);
 
        if (o->stream) {
                php_http_encoding_stream_free(&o->stream);
        }
 
        if (o->stream) {
                php_http_encoding_stream_free(&o->stream);
        }
-       zend_object_std_dtor((zend_object *) o TSRMLS_CC);
-       efree(o);
+       zend_object_std_dtor(object);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream___construct, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream___construct, 0, 0, 0)
@@ -968,31 +948,31 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream___construct, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, __construct)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, __construct)
 {
-       long flags = 0;
+       zend_long flags = 0;
        php_http_encoding_stream_object_t *obj;
        php_http_encoding_stream_ops_t *ops;
 
        php_http_encoding_stream_object_t *obj;
        php_http_encoding_stream_ops_t *ops;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        if (obj->stream) {
                php_http_throw(bad_method_call, "http\\Encoding\\Stream cannot be initialized twice", NULL);
                return;
        }
 
 
        if (obj->stream) {
                php_http_throw(bad_method_call, "http\\Encoding\\Stream cannot be initialized twice", NULL);
                return;
        }
 
-       if (instanceof_function(obj->zo.ce, php_http_deflate_stream_class_entry TSRMLS_CC)) {
+       if (instanceof_function(obj->zo.ce, php_http_deflate_stream_class_entry)) {
                ops = &php_http_encoding_deflate_ops;
                ops = &php_http_encoding_deflate_ops;
-       } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_class_entry TSRMLS_CC)) {
+       } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_class_entry)) {
                ops = &php_http_encoding_inflate_ops;
                ops = &php_http_encoding_inflate_ops;
-       } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_class_entry TSRMLS_CC)) {
+       } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_class_entry)) {
                ops = &php_http_encoding_dechunk_ops;
        } else {
                ops = &php_http_encoding_dechunk_ops;
        } else {
-               php_http_throw(runtime, "Unknown http\\Encoding\\Stream class '%s'", obj->zo.ce->name);
+               php_http_throw(runtime, "Unknown http\\Encoding\\Stream class '%s'", obj->zo.ce->name->val);
                return;
        }
 
                return;
        }
 
-       php_http_expect(obj->stream = php_http_encoding_stream_init(obj->stream, ops, flags TSRMLS_CC), runtime, return);
+       php_http_expect(obj->stream = php_http_encoding_stream_init(obj->stream, ops, flags), runtime, return);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_update, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_update, 0, 0, 1)
@@ -1000,18 +980,22 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_update, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, update)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, update)
 {
-       int data_len;
+       size_t data_len;
        char *data_str;
 
        char *data_str;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data_str, &data_len)) {
-               php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data_str, &data_len)) {
+               php_http_encoding_stream_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                if (obj->stream) {
 
                if (obj->stream) {
+                       char *encoded_str = NULL;
                        size_t encoded_len;
                        size_t encoded_len;
-                       char *encoded_str;
 
                        if (SUCCESS == php_http_encoding_stream_update(obj->stream, data_str, data_len, &encoded_str, &encoded_len)) {
 
                        if (SUCCESS == php_http_encoding_stream_update(obj->stream, data_str, data_len, &encoded_str, &encoded_len)) {
-                               RETURN_STRINGL(encoded_str, encoded_len, 0);
+                               if (encoded_str) {
+                                       RETURN_STR(php_http_cs2zs(encoded_str, encoded_len));
+                               } else {
+                                       RETURN_EMPTY_STRING();
+                               }
                        }
                }
        }
                        }
                }
        }
@@ -1022,15 +1006,15 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, flush)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpEncodingStream, flush)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_encoding_stream_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                if (obj->stream) {
 
                if (obj->stream) {
-                       char *encoded_str;
+                       char *encoded_str = NULL;
                        size_t encoded_len;
 
                        if (SUCCESS == php_http_encoding_stream_flush(obj->stream, &encoded_str, &encoded_len)) {
                                if (encoded_str) {
                        size_t encoded_len;
 
                        if (SUCCESS == php_http_encoding_stream_flush(obj->stream, &encoded_str, &encoded_len)) {
                                if (encoded_str) {
-                                       RETURN_STRINGL(encoded_str, encoded_len, 0);
+                                       RETURN_STR(php_http_cs2zs(encoded_str, encoded_len));
                                } else {
                                        RETURN_EMPTY_STRING();
                                }
                                } else {
                                        RETURN_EMPTY_STRING();
                                }
@@ -1044,7 +1028,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, done)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpEncodingStream, done)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_encoding_stream_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                if (obj->stream) {
                        RETURN_BOOL(php_http_encoding_stream_done(obj->stream));
 
                if (obj->stream) {
                        RETURN_BOOL(php_http_encoding_stream_done(obj->stream));
@@ -1057,16 +1041,16 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpEncodingStream, finish)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpEncodingStream, finish)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_encoding_stream_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                if (obj->stream) {
 
                if (obj->stream) {
-                       char *encoded_str;
+                       char *encoded_str = NULL;
                        size_t encoded_len;
 
                        if (SUCCESS == php_http_encoding_stream_finish(obj->stream, &encoded_str, &encoded_len)) {
                                if (SUCCESS == php_http_encoding_stream_reset(&obj->stream)) {
                                        if (encoded_str) {
                        size_t encoded_len;
 
                        if (SUCCESS == php_http_encoding_stream_finish(obj->stream, &encoded_str, &encoded_len)) {
                                if (SUCCESS == php_http_encoding_stream_reset(&obj->stream)) {
                                        if (encoded_str) {
-                                               RETURN_STRINGL(encoded_str, encoded_len, 0);
+                                               RETURN_STR(php_http_cs2zs(encoded_str, encoded_len));
                                        } else {
                                                RETURN_EMPTY_STRING();
                                        }
                                        } else {
                                                RETURN_EMPTY_STRING();
                                        }
@@ -1094,15 +1078,19 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpDeflateStream, encode)
 {
        char *str;
 static PHP_METHOD(HttpDeflateStream, encode)
 {
        char *str;
-       int len;
-       long flags = 0;
+       size_t len;
+       zend_long flags = 0;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &len, &flags)) {
-               char *enc_str;
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &len, &flags)) {
+               char *enc_str = NULL;
                size_t enc_len;
 
                size_t enc_len;
 
-               if (SUCCESS == php_http_encoding_deflate(flags, str, len, &enc_str, &enc_len TSRMLS_CC)) {
-                       RETURN_STRINGL(enc_str, enc_len, 0);
+               if (SUCCESS == php_http_encoding_deflate(flags, str, len, &enc_str, &enc_len)) {
+                       if (enc_str) {
+                               RETURN_STR(php_http_cs2zs(enc_str, enc_len));
+                       } else {
+                               RETURN_EMPTY_STRING();
+                       }
                }
        }
        RETURN_FALSE;
                }
        }
        RETURN_FALSE;
@@ -1119,14 +1107,18 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpInflateStream, decode)
 {
        char *str;
 static PHP_METHOD(HttpInflateStream, decode)
 {
        char *str;
-       int len;
+       size_t len;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len)) {
-               char *enc_str;
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len)) {
+               char *enc_str = NULL;
                size_t enc_len;
 
                size_t enc_len;
 
-               if (SUCCESS == php_http_encoding_inflate(str, len, &enc_str, &enc_len TSRMLS_CC)) {
-                       RETURN_STRINGL(enc_str, enc_len, 0);
+               if (SUCCESS == php_http_encoding_inflate(str, len, &enc_str, &enc_len)) {
+                       if (enc_str) {
+                               RETURN_STR(php_http_cs2zs(enc_str, enc_len));
+                       } else {
+                               RETURN_EMPTY_STRING();
+                       }
                }
        }
        RETURN_FALSE;
                }
        }
        RETURN_FALSE;
@@ -1144,20 +1136,24 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpDechunkStream, decode)
 {
        char *str;
 static PHP_METHOD(HttpDechunkStream, decode)
 {
        char *str;
-       int len;
+       size_t len;
        zval *zlen = NULL;
 
        zval *zlen = NULL;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!", &str, &len, &zlen)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|z!", &str, &len, &zlen)) {
                const char *end_ptr;
                const char *end_ptr;
-               char *enc_str;
+               char *enc_str = NULL;
                size_t enc_len;
 
                size_t enc_len;
 
-               if ((end_ptr = php_http_encoding_dechunk(str, len, &enc_str, &enc_len TSRMLS_CC))) {
+               if ((end_ptr = php_http_encoding_dechunk(str, len, &enc_str, &enc_len))) {
                        if (zlen) {
                                zval_dtor(zlen);
                                ZVAL_LONG(zlen, str + len - end_ptr);
                        }
                        if (zlen) {
                                zval_dtor(zlen);
                                ZVAL_LONG(zlen, str + len - end_ptr);
                        }
-                       RETURN_STRINGL(enc_str, enc_len, 0);
+                       if (enc_str) {
+                               RETURN_STR(php_http_cs2zs(enc_str, enc_len));
+                       } else {
+                               RETURN_EMPTY_STRING();
+                       }
                }
        }
        RETURN_FALSE;
                }
        }
        RETURN_FALSE;
@@ -1178,39 +1174,40 @@ PHP_MINIT_FUNCTION(http_encoding)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding", "Stream", php_http_encoding_stream_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding", "Stream", php_http_encoding_stream_methods);
-       php_http_encoding_stream_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_encoding_stream_class_entry = zend_register_internal_class(&ce);
        php_http_encoding_stream_class_entry->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
        php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new;
        memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone;
        php_http_encoding_stream_class_entry->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
        php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new;
        memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone;
+       php_http_encoding_stream_object_handlers.dtor_obj = php_http_encoding_stream_object_free;
 
 
-       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_NONE"), PHP_HTTP_ENCODING_STREAM_FLUSH_NONE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_SYNC"), PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_FULL"), PHP_HTTP_ENCODING_STREAM_FLUSH_FULL TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_NONE"), PHP_HTTP_ENCODING_STREAM_FLUSH_NONE);
+       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_SYNC"), PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC);
+       zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_FULL"), PHP_HTTP_ENCODING_STREAM_FLUSH_FULL);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Deflate", php_http_deflate_stream_methods);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Deflate", php_http_deflate_stream_methods);
-       php_http_deflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
-
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_GZIP"), PHP_HTTP_DEFLATE_TYPE_GZIP TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_ZLIB"), PHP_HTTP_DEFLATE_TYPE_ZLIB TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_RAW"), PHP_HTTP_DEFLATE_TYPE_RAW TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_DEF"), PHP_HTTP_DEFLATE_LEVEL_DEF TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_MIN"), PHP_HTTP_DEFLATE_LEVEL_MIN TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_MAX"), PHP_HTTP_DEFLATE_LEVEL_MAX TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_DEF"), PHP_HTTP_DEFLATE_STRATEGY_DEF TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FILT"), PHP_HTTP_DEFLATE_STRATEGY_FILT TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_HUFF"), PHP_HTTP_DEFLATE_STRATEGY_HUFF TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_RLE"), PHP_HTTP_DEFLATE_STRATEGY_RLE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FIXED"), PHP_HTTP_DEFLATE_STRATEGY_FIXED TSRMLS_CC);
+       php_http_deflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry);
+
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_GZIP"), PHP_HTTP_DEFLATE_TYPE_GZIP);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_ZLIB"), PHP_HTTP_DEFLATE_TYPE_ZLIB);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_RAW"), PHP_HTTP_DEFLATE_TYPE_RAW);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_DEF"), PHP_HTTP_DEFLATE_LEVEL_DEF);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_MIN"), PHP_HTTP_DEFLATE_LEVEL_MIN);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("LEVEL_MAX"), PHP_HTTP_DEFLATE_LEVEL_MAX);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_DEF"), PHP_HTTP_DEFLATE_STRATEGY_DEF);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FILT"), PHP_HTTP_DEFLATE_STRATEGY_FILT);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_HUFF"), PHP_HTTP_DEFLATE_STRATEGY_HUFF);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_RLE"), PHP_HTTP_DEFLATE_STRATEGY_RLE);
+       zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FIXED"), PHP_HTTP_DEFLATE_STRATEGY_FIXED);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Inflate", php_http_inflate_stream_methods);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Inflate", php_http_inflate_stream_methods);
-       php_http_inflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
+       php_http_inflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Dechunk", php_http_dechunk_stream_methods);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Dechunk", php_http_dechunk_stream_methods);
-       php_http_dechunk_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
+       php_http_dechunk_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index 59bbd278cd21ad8e382debffa07a01311160a0fe..ea767dd1f267526e92afaa574711bbb92e3c40d5 100644 (file)
@@ -125,10 +125,10 @@ typedef struct php_http_encoding_stream php_http_encoding_stream_t;
 
 typedef php_http_encoding_stream_t *(*php_http_encoding_stream_init_func_t)(php_http_encoding_stream_t *s);
 typedef php_http_encoding_stream_t *(*php_http_encoding_stream_copy_func_t)(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to);
 
 typedef php_http_encoding_stream_t *(*php_http_encoding_stream_init_func_t)(php_http_encoding_stream_t *s);
 typedef php_http_encoding_stream_t *(*php_http_encoding_stream_copy_func_t)(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to);
-typedef STATUS (*php_http_encoding_stream_update_func_t)(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len);
-typedef STATUS (*php_http_encoding_stream_flush_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
+typedef ZEND_RESULT_CODE (*php_http_encoding_stream_update_func_t)(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len);
+typedef ZEND_RESULT_CODE (*php_http_encoding_stream_flush_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
 typedef zend_bool (*php_http_encoding_stream_done_func_t)(php_http_encoding_stream_t *s);
 typedef zend_bool (*php_http_encoding_stream_done_func_t)(php_http_encoding_stream_t *s);
-typedef STATUS (*php_http_encoding_stream_finish_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
+typedef ZEND_RESULT_CODE (*php_http_encoding_stream_finish_func_t)(php_http_encoding_stream_t *s, char **out_str, size_t *out_len);
 typedef void (*php_http_encoding_stream_dtor_func_t)(php_http_encoding_stream_t *s);
 
 typedef struct php_http_encoding_stream_ops {
 typedef void (*php_http_encoding_stream_dtor_func_t)(php_http_encoding_stream_t *s);
 
 typedef struct php_http_encoding_stream_ops {
@@ -145,41 +145,37 @@ struct php_http_encoding_stream {
        unsigned flags;
        void *ctx;
        php_http_encoding_stream_ops_t *ops;
        unsigned flags;
        void *ctx;
        php_http_encoding_stream_ops_t *ops;
-#ifdef ZTS
-       void ***ts;
-#endif
 };
 
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_deflate_ops(void);
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_inflate_ops(void);
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void);
 
 };
 
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_deflate_ops(void);
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_inflate_ops(void);
 PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void);
 
-PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags TSRMLS_DC);
+PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags);
 PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to);
 PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to);
-PHP_HTTP_API STATUS php_http_encoding_stream_reset(php_http_encoding_stream_t **s);
-PHP_HTTP_API STATUS php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len);
-PHP_HTTP_API STATUS php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_reset(php_http_encoding_stream_t **s);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_update(php_http_encoding_stream_t *s, const char *in_str, size_t in_len, char **out_str, size_t *out_len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_flush(php_http_encoding_stream_t *s, char **out_str, size_t *len);
 PHP_HTTP_API zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s);
 PHP_HTTP_API zend_bool php_http_encoding_stream_done(php_http_encoding_stream_t *s);
-PHP_HTTP_API STATUS php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_stream_finish(php_http_encoding_stream_t *s, char **out_str, size_t *len);
 PHP_HTTP_API void php_http_encoding_stream_dtor(php_http_encoding_stream_t *s);
 PHP_HTTP_API void php_http_encoding_stream_free(php_http_encoding_stream_t **s);
 
 PHP_HTTP_API void php_http_encoding_stream_dtor(php_http_encoding_stream_t *s);
 PHP_HTTP_API void php_http_encoding_stream_free(php_http_encoding_stream_t **s);
 
-PHP_HTTP_API const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len TSRMLS_DC);
+PHP_HTTP_API const char *php_http_encoding_dechunk(const char *encoded, size_t encoded_len, char **decoded, size_t *decoded_len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_deflate(int flags, const char *data, size_t data_len, char **encoded, size_t *encoded_len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_encoding_inflate(const char *data, size_t data_len, char **decoded, size_t *decoded_len);
 
 typedef struct php_http_encoding_stream_object {
 
 typedef struct php_http_encoding_stream_object {
-       zend_object zo;
-       zend_object_value zv;
        php_http_encoding_stream_t *stream;
        php_http_encoding_stream_t *stream;
+       zend_object zo;
 } php_http_encoding_stream_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_encoding_stream_class_entry;
 
 } php_http_encoding_stream_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_encoding_stream_class_entry;
 
-zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC);
-zend_object_value php_http_encoding_stream_object_clone(zval *object TSRMLS_DC);
-void php_http_encoding_stream_object_free(void *object TSRMLS_DC);
+zend_object *php_http_encoding_stream_object_new(zend_class_entry *ce);
+php_http_encoding_stream_object_t *php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s);
+zend_object *php_http_encoding_stream_object_clone(zval *object);
+void php_http_encoding_stream_object_free(zend_object *object);
 
 PHP_HTTP_API zend_class_entry *php_http_deflate_stream_class_entry;
 PHP_HTTP_API zend_class_entry *php_http_inflate_stream_class_entry;
 
 PHP_HTTP_API zend_class_entry *php_http_deflate_stream_class_entry;
 PHP_HTTP_API zend_class_entry *php_http_inflate_stream_class_entry;
index 25759a65e83c5da71bd866a876471d8ecc9c5de6..e1ff585d72482ecea7d36faa673243b81d899e7b 100644 (file)
@@ -430,9 +430,9 @@ static void grab_headers(void *data, void *arg TSRMLS_DC)
        php_http_buffer_appends(PHP_HTTP_BUFFER(arg), PHP_HTTP_CRLF);
 }
 
        php_http_buffer_appends(PHP_HTTP_BUFFER(arg), PHP_HTTP_CRLF);
 }
 
-STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC)
 {
 {
-       STATUS status;
+       ZEND_RESULT_CODE status;
        php_http_buffer_t headers;
 
        php_http_buffer_init(&headers);
        php_http_buffer_t headers;
 
        php_http_buffer_init(&headers);
@@ -475,15 +475,15 @@ long php_http_env_get_response_code(TSRMLS_D)
        return code ? code : 200;
 }
 
        return code ? code : 200;
 }
 
-STATUS php_http_env_set_response_code(long http_code TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_code(long http_code TSRMLS_DC)
 {
        return sapi_header_op(SAPI_HEADER_SET_STATUS, (void *) http_code TSRMLS_CC);
 }
 
 {
        return sapi_header_op(SAPI_HEADER_SET_STATUS, (void *) http_code TSRMLS_CC);
 }
 
-STATUS php_http_env_set_response_status_line(long code, php_http_version_t *v TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_status_line(long code, php_http_version_t *v TSRMLS_DC)
 {
        sapi_header_line h = {NULL, 0, 0};
 {
        sapi_header_line h = {NULL, 0, 0};
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
 
        h.line_len = spprintf(&h.line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code));
        ret = sapi_header_op(SAPI_HEADER_REPLACE, (void *) &h TSRMLS_CC);
 
        h.line_len = spprintf(&h.line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code));
        ret = sapi_header_op(SAPI_HEADER_REPLACE, (void *) &h TSRMLS_CC);
@@ -492,22 +492,22 @@ STATUS php_http_env_set_response_status_line(long code, php_http_version_t *v TS
        return ret;
 }
 
        return ret;
 }
 
-STATUS php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC)
 {
        return php_http_env_set_response_status_line(php_http_env_get_response_code(TSRMLS_C), v TSRMLS_CC);
 }
 
 {
        return php_http_env_set_response_status_line(php_http_env_get_response_code(TSRMLS_C), v TSRMLS_CC);
 }
 
-STATUS php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC)
 {
        sapi_header_line h = {estrndup(header_str, header_len), header_len, http_code};
 {
        sapi_header_line h = {estrndup(header_str, header_len), header_len, http_code};
-       STATUS ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h TSRMLS_CC);
+       ZEND_RESULT_CODE ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h TSRMLS_CC);
        efree(h.line);
        return ret;
 }
 
        efree(h.line);
        return ret;
 }
 
-STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC)
 {
 {
-       STATUS ret = FAILURE;
+       ZEND_RESULT_CODE ret = FAILURE;
        sapi_header_line h = {NULL, 0, http_code};
 
        h.line_len = vspprintf(&h.line, 0, fmt, argv);
        sapi_header_line h = {NULL, 0, http_code};
 
        h.line_len = vspprintf(&h.line, 0, fmt, argv);
@@ -521,9 +521,9 @@ STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, co
        return ret;
 }
 
        return ret;
 }
 
-STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...)
+ZEND_RESULT_CODE php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...)
 {
 {
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
        va_list args;
 
        va_start(args, fmt);
        va_list args;
 
        va_start(args, fmt);
@@ -533,7 +533,7 @@ STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace
        return ret;
 }
 
        return ret;
 }
 
-STATUS php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC)
+ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC)
 {
        if (!value) {
                sapi_header_line h = {(char *) name_str, name_len, http_code};
 {
        if (!value) {
                sapi_header_line h = {(char *) name_str, name_len, http_code};
@@ -562,7 +562,7 @@ STATUS php_http_env_set_response_header_value(long http_code, const char *name_s
                        return php_http_env_set_response_header_value(http_code, name_str, name_len, NULL, replace TSRMLS_CC);
                } else {
                        sapi_header_line h;
                        return php_http_env_set_response_header_value(http_code, name_str, name_len, NULL, replace TSRMLS_CC);
                } else {
                        sapi_header_line h;
-                       STATUS ret;
+                       ZEND_RESULT_CODE ret;
 
                        if (name_len > INT_MAX) {
                                name_len = INT_MAX;
 
                        if (name_len > INT_MAX) {
                                name_len = INT_MAX;
index 7556c3efb68e77e4de0129d1ab18b1e0aeffe3aa..8d2d1bb8507c956f9298b00c3972bb6c687829e2 100644 (file)
@@ -58,14 +58,14 @@ typedef enum php_http_cache_status {
 
 PHP_HTTP_API long php_http_env_get_response_code(TSRMLS_D);
 PHP_HTTP_API const char *php_http_env_get_response_status_for_code(unsigned code);
 
 PHP_HTTP_API long php_http_env_get_response_code(TSRMLS_D);
 PHP_HTTP_API const char *php_http_env_get_response_status_for_code(unsigned code);
-PHP_HTTP_API STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC);
 PHP_HTTP_API char *php_http_env_get_response_header(const char *name_str, size_t name_len TSRMLS_DC);
 PHP_HTTP_API char *php_http_env_get_response_header(const char *name_str, size_t name_len TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_set_response_code(long http_code TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...);
-PHP_HTTP_API STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_code(long http_code TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC);
 
 PHP_HTTP_API zval *php_http_env_get_server_var(const char *key_str, size_t key_len, zend_bool check TSRMLS_DC);
 #define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC))
 
 PHP_HTTP_API zval *php_http_env_get_server_var(const char *key_str, size_t key_len, zend_bool check TSRMLS_DC);
 #define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC))
index 52d561ac19eeaae62417e1e3840afdb166a0a6e8..3d8c36d84291832eb00abd2fa2c04b80793a08fd 100644 (file)
@@ -263,7 +263,7 @@ static size_t output(void *context, char *buf, size_t len TSRMLS_DC)
 }
 
 #define php_http_env_response_send_done(r) php_http_env_response_send_data((r), NULL, 0)
 }
 
 #define php_http_env_response_send_done(r) php_http_env_response_send_data((r), NULL, 0)
-static STATUS php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len)
+static ZEND_RESULT_CODE php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len)
 {
        size_t chunks_sent, chunk = r->throttle.chunk ? r->throttle.chunk : PHP_HTTP_SENDBUF_SIZE;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 {
        size_t chunks_sent, chunk = r->throttle.chunk ? r->throttle.chunk : PHP_HTTP_SENDBUF_SIZE;
        TSRMLS_FETCH_FROM_CTX(r->ts);
@@ -351,9 +351,9 @@ void php_http_env_response_free(php_http_env_response_t **r)
        }
 }
 
        }
 }
 
-static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_http_message_t *request)
+static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t *r, php_http_message_t *request)
 {
 {
-       STATUS ret = SUCCESS;
+       ZEND_RESULT_CODE ret = SUCCESS;
        zval *zoption, *options = r->options;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        zval *zoption, *options = r->options;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
@@ -608,9 +608,9 @@ static STATUS php_http_env_response_send_head(php_http_env_response_t *r, php_ht
        return ret;
 }
 
        return ret;
 }
 
-static STATUS php_http_env_response_send_body(php_http_env_response_t *r)
+static ZEND_RESULT_CODE php_http_env_response_send_body(php_http_env_response_t *r)
 {
 {
-       STATUS ret = SUCCESS;
+       ZEND_RESULT_CODE ret = SUCCESS;
        zval *zoption;
        php_http_message_body_t *body;
        TSRMLS_FETCH_FROM_CTX(r->ts);
        zval *zoption;
        php_http_message_body_t *body;
        TSRMLS_FETCH_FROM_CTX(r->ts);
@@ -696,7 +696,7 @@ static STATUS php_http_env_response_send_body(php_http_env_response_t *r)
        return ret;
 }
 
        return ret;
 }
 
-STATUS php_http_env_response_send(php_http_env_response_t *r)
+ZEND_RESULT_CODE php_http_env_response_send(php_http_env_response_t *r)
 {
        php_http_message_t *request;
        php_http_message_body_t *body;
 {
        php_http_message_t *request;
        php_http_message_body_t *body;
@@ -784,21 +784,21 @@ static long php_http_env_response_sapi_get_status(php_http_env_response_t *r)
 
        return php_http_env_get_response_code(TSRMLS_C);
 }
 
        return php_http_env_get_response_code(TSRMLS_C);
 }
-static STATUS php_http_env_response_sapi_set_status(php_http_env_response_t *r, long http_code)
+static ZEND_RESULT_CODE php_http_env_response_sapi_set_status(php_http_env_response_t *r, long http_code)
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_code(http_code TSRMLS_CC);
 }
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_code(http_code TSRMLS_CC);
 }
-static STATUS php_http_env_response_sapi_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v)
+static ZEND_RESULT_CODE php_http_env_response_sapi_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v)
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_protocol_version(v TSRMLS_CC);
 }
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_protocol_version(v TSRMLS_CC);
 }
-static STATUS php_http_env_response_sapi_set_header(php_http_env_response_t *r, const char *fmt, ...)
+static ZEND_RESULT_CODE php_http_env_response_sapi_set_header(php_http_env_response_t *r, const char *fmt, ...)
 {
 {
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
        va_list args;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        va_list args;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
@@ -808,9 +808,9 @@ static STATUS php_http_env_response_sapi_set_header(php_http_env_response_t *r,
 
        return ret;
 }
 
        return ret;
 }
-static STATUS php_http_env_response_sapi_add_header(php_http_env_response_t *r, const char *fmt, ...)
+static ZEND_RESULT_CODE php_http_env_response_sapi_add_header(php_http_env_response_t *r, const char *fmt, ...)
 {
 {
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
        va_list args;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        va_list args;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
@@ -820,13 +820,13 @@ static STATUS php_http_env_response_sapi_add_header(php_http_env_response_t *r,
 
        return ret;
 }
 
        return ret;
 }
-static STATUS php_http_env_response_sapi_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len)
+static ZEND_RESULT_CODE php_http_env_response_sapi_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len)
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_header_value(0, header_str, header_len, NULL, 1 TSRMLS_CC);
 }
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
        return php_http_env_set_response_header_value(0, header_str, header_len, NULL, 1 TSRMLS_CC);
 }
-static STATUS php_http_env_response_sapi_write(php_http_env_response_t *r, const char *data_str, size_t data_len)
+static ZEND_RESULT_CODE php_http_env_response_sapi_write(php_http_env_response_t *r, const char *data_str, size_t data_len)
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
@@ -835,7 +835,7 @@ static STATUS php_http_env_response_sapi_write(php_http_env_response_t *r, const
        }
        return FAILURE;
 }
        }
        return FAILURE;
 }
-static STATUS php_http_env_response_sapi_flush(php_http_env_response_t *r)
+static ZEND_RESULT_CODE php_http_env_response_sapi_flush(php_http_env_response_t *r)
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
 {
        TSRMLS_FETCH_FROM_CTX(r->ts);
 
@@ -853,7 +853,7 @@ static STATUS php_http_env_response_sapi_flush(php_http_env_response_t *r)
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
-static STATUS php_http_env_response_sapi_finish(php_http_env_response_t *r)
+static ZEND_RESULT_CODE php_http_env_response_sapi_finish(php_http_env_response_t *r)
 {
        return SUCCESS;
 }
 {
        return SUCCESS;
 }
@@ -888,7 +888,7 @@ typedef struct php_http_env_response_stream_ctx {
        unsigned finished:1;
 } php_http_env_response_stream_ctx_t;
 
        unsigned finished:1;
 } php_http_env_response_stream_ctx_t;
 
-static STATUS php_http_env_response_stream_init(php_http_env_response_t *r, void *init_arg)
+static ZEND_RESULT_CODE php_http_env_response_stream_init(php_http_env_response_t *r, void *init_arg)
 {
        php_http_env_response_stream_ctx_t *ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 {
        php_http_env_response_stream_ctx_t *ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
@@ -935,7 +935,7 @@ static void php_http_env_response_stream_header(php_http_env_response_stream_ctx
                }
        }
 }
                }
        }
 }
-static STATUS php_http_env_response_stream_start(php_http_env_response_stream_ctx_t *ctx TSRMLS_DC)
+static ZEND_RESULT_CODE php_http_env_response_stream_start(php_http_env_response_stream_ctx_t *ctx TSRMLS_DC)
 {
        if (ctx->started || ctx->finished) {
                return FAILURE;
 {
        if (ctx->started || ctx->finished) {
                return FAILURE;
@@ -953,7 +953,7 @@ static long php_http_env_response_stream_get_status(php_http_env_response_t *r)
 
        return ctx->status_code;
 }
 
        return ctx->status_code;
 }
-static STATUS php_http_env_response_stream_set_status(php_http_env_response_t *r, long http_code)
+static ZEND_RESULT_CODE php_http_env_response_stream_set_status(php_http_env_response_t *r, long http_code)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
@@ -965,7 +965,7 @@ static STATUS php_http_env_response_stream_set_status(php_http_env_response_t *r
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
-static STATUS php_http_env_response_stream_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v)
+static ZEND_RESULT_CODE php_http_env_response_stream_set_protocol_version(php_http_env_response_t *r, php_http_version_t *v)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
@@ -977,7 +977,7 @@ static STATUS php_http_env_response_stream_set_protocol_version(php_http_env_res
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
-static STATUS php_http_env_response_stream_set_header_ex(php_http_env_response_t *r, zend_bool replace, const char *fmt, va_list argv)
+static ZEND_RESULT_CODE php_http_env_response_stream_set_header_ex(php_http_env_response_t *r, zend_bool replace, const char *fmt, va_list argv)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        char *header_end, *header_str = NULL;
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        char *header_end, *header_str = NULL;
@@ -1014,9 +1014,9 @@ static STATUS php_http_env_response_stream_set_header_ex(php_http_env_response_t
                return SUCCESS;
        }
 }
                return SUCCESS;
        }
 }
-static STATUS php_http_env_response_stream_set_header(php_http_env_response_t *r, const char *fmt, ...)
+static ZEND_RESULT_CODE php_http_env_response_stream_set_header(php_http_env_response_t *r, const char *fmt, ...)
 {
 {
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
        va_list argv;
 
        va_start(argv, fmt);
        va_list argv;
 
        va_start(argv, fmt);
@@ -1025,9 +1025,9 @@ static STATUS php_http_env_response_stream_set_header(php_http_env_response_t *r
 
        return ret;
 }
 
        return ret;
 }
-static STATUS php_http_env_response_stream_add_header(php_http_env_response_t *r, const char *fmt, ...)
+static ZEND_RESULT_CODE php_http_env_response_stream_add_header(php_http_env_response_t *r, const char *fmt, ...)
 {
 {
-       STATUS ret;
+       ZEND_RESULT_CODE ret;
        va_list argv;
 
        va_start(argv, fmt);
        va_list argv;
 
        va_start(argv, fmt);
@@ -1036,7 +1036,7 @@ static STATUS php_http_env_response_stream_add_header(php_http_env_response_t *r
 
        return ret;
 }
 
        return ret;
 }
-static STATUS php_http_env_response_stream_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len)
+static ZEND_RESULT_CODE php_http_env_response_stream_del_header(php_http_env_response_t *r, const char *header_str, size_t header_len)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
 
@@ -1047,7 +1047,7 @@ static STATUS php_http_env_response_stream_del_header(php_http_env_response_t *r
        zend_hash_del(&stream_ctx->header, header_str, header_len + 1);
        return SUCCESS;
 }
        zend_hash_del(&stream_ctx->header, header_str, header_len + 1);
        return SUCCESS;
 }
-static STATUS php_http_env_response_stream_write(php_http_env_response_t *r, const char *data_str, size_t data_len)
+static ZEND_RESULT_CODE php_http_env_response_stream_write(php_http_env_response_t *r, const char *data_str, size_t data_len)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
@@ -1067,7 +1067,7 @@ static STATUS php_http_env_response_stream_write(php_http_env_response_t *r, con
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
-static STATUS php_http_env_response_stream_flush(php_http_env_response_t *r)
+static ZEND_RESULT_CODE php_http_env_response_stream_flush(php_http_env_response_t *r)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
@@ -1083,7 +1083,7 @@ static STATUS php_http_env_response_stream_flush(php_http_env_response_t *r)
 
        return php_stream_flush(stream_ctx->stream);
 }
 
        return php_stream_flush(stream_ctx->stream);
 }
-static STATUS php_http_env_response_stream_finish(php_http_env_response_t *r)
+static ZEND_RESULT_CODE php_http_env_response_stream_finish(php_http_env_response_t *r)
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
 {
        php_http_env_response_stream_ctx_t *stream_ctx = r->ctx;
        TSRMLS_FETCH_FROM_CTX(r->ts);
index b67293050cbf34af925988f50a53b6673cda5c80..e6a112f5417fba84fc390f78b82a266372bdbb6d 100644 (file)
 typedef struct php_http_env_response php_http_env_response_t;
 
 typedef struct php_http_env_response_ops {
 typedef struct php_http_env_response php_http_env_response_t;
 
 typedef struct php_http_env_response_ops {
-       STATUS (*init)(php_http_env_response_t *r, void *arg);
+       ZEND_RESULT_CODE (*init)(php_http_env_response_t *r, void *arg);
        void (*dtor)(php_http_env_response_t *r);
        long (*get_status)(php_http_env_response_t *r);
        void (*dtor)(php_http_env_response_t *r);
        long (*get_status)(php_http_env_response_t *r);
-       STATUS (*set_status)(php_http_env_response_t *r, long http_code);
-       STATUS (*set_protocol_version)(php_http_env_response_t *r, php_http_version_t *v);
-       STATUS (*set_header)(php_http_env_response_t *r, const char *fmt, ...);
-       STATUS (*add_header)(php_http_env_response_t *r, const char *fmt, ...);
-       STATUS (*del_header)(php_http_env_response_t *r, const char *header_str, size_t header_len);
-       STATUS (*write)(php_http_env_response_t *r, const char *data_str, size_t data_len);
-       STATUS (*flush)(php_http_env_response_t *r);
-       STATUS (*finish)(php_http_env_response_t *r);
+       ZEND_RESULT_CODE (*set_status)(php_http_env_response_t *r, long http_code);
+       ZEND_RESULT_CODE (*set_protocol_version)(php_http_env_response_t *r, php_http_version_t *v);
+       ZEND_RESULT_CODE (*set_header)(php_http_env_response_t *r, const char *fmt, ...);
+       ZEND_RESULT_CODE (*add_header)(php_http_env_response_t *r, const char *fmt, ...);
+       ZEND_RESULT_CODE (*del_header)(php_http_env_response_t *r, const char *header_str, size_t header_len);
+       ZEND_RESULT_CODE (*write)(php_http_env_response_t *r, const char *data_str, size_t data_len);
+       ZEND_RESULT_CODE (*flush)(php_http_env_response_t *r);
+       ZEND_RESULT_CODE (*finish)(php_http_env_response_t *r);
 } php_http_env_response_ops_t;
 
 PHP_HTTP_API php_http_env_response_ops_t *php_http_env_response_get_sapi_ops(void);
 } php_http_env_response_ops_t;
 
 PHP_HTTP_API php_http_env_response_ops_t *php_http_env_response_get_sapi_ops(void);
@@ -67,7 +67,7 @@ struct php_http_env_response {
 };
 
 PHP_HTTP_API php_http_env_response_t *php_http_env_response_init(php_http_env_response_t *r, zval *options, php_http_env_response_ops_t *ops, void *ops_ctx TSRMLS_DC);
 };
 
 PHP_HTTP_API php_http_env_response_t *php_http_env_response_init(php_http_env_response_t *r, zval *options, php_http_env_response_ops_t *ops, void *ops_ctx TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_env_response_send(php_http_env_response_t *r);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_env_response_send(php_http_env_response_t *r);
 PHP_HTTP_API void php_http_env_response_dtor(php_http_env_response_t *r);
 PHP_HTTP_API void php_http_env_response_free(php_http_env_response_t **r);
 
 PHP_HTTP_API void php_http_env_response_dtor(php_http_env_response_t *r);
 PHP_HTTP_API void php_http_env_response_free(php_http_env_response_t **r);
 
index 3604ad8673957f6ca4f52f35420fe06cb15eae14..1ebddb35d4a7b283db6cc07c954133bbbde18c2e 100644 (file)
@@ -20,7 +20,7 @@
 #include <ext/standard/sha1.h>
 #include <ext/standard/md5.h>
 
 #include <ext/standard/sha1.h>
 #include <ext/standard/md5.h>
 
-php_http_etag_t *php_http_etag_init(const char *mode TSRMLS_DC)
+php_http_etag_t *php_http_etag_init(const char *mode)
 {
        void *ctx;
        php_http_etag_t *e;
 {
        void *ctx;
        php_http_etag_t *e;
@@ -47,7 +47,6 @@ php_http_etag_t *php_http_etag_init(const char *mode TSRMLS_DC)
        e = emalloc(sizeof(*e));
        e->ctx = ctx;
        e->mode = estrdup(mode);
        e = emalloc(sizeof(*e));
        e->ctx = ctx;
        e->mode = estrdup(mode);
-       TSRMLS_SET_CTX(e->ts);
 
        return e;
 }
 
        return e;
 }
index bf6cf49e4a685cf82313fcea9a384856c95a654a..f208db7a48a685f1784adeaa52380a0da082e42f 100644 (file)
 typedef struct php_http_etag {
        void *ctx;
        char *mode;
 typedef struct php_http_etag {
        void *ctx;
        char *mode;
-
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_etag_t;
 
 } php_http_etag_t;
 
-PHP_HTTP_API php_http_etag_t *php_http_etag_init(const char *mode TSRMLS_DC);
+PHP_HTTP_API php_http_etag_t *php_http_etag_init(const char *mode);
 PHP_HTTP_API size_t php_http_etag_update(php_http_etag_t *e, const char *data_ptr, size_t data_len);
 PHP_HTTP_API char *php_http_etag_finish(php_http_etag_t *e);
 
 PHP_HTTP_API size_t php_http_etag_update(php_http_etag_t *e, const char *data_ptr, size_t data_len);
 PHP_HTTP_API char *php_http_etag_finish(php_http_etag_t *e);
 
index 25a33e6f9c93e80d7126c3dc0ca6b6f1337fa677..bae09f983dfdca4a74ce8e64abe072ca910334a1 100644 (file)
 #endif
 
 #if PHP_HTTP_DBG_EXCEPTIONS
 #endif
 
 #if PHP_HTTP_DBG_EXCEPTIONS
-static void php_http_exception_hook(zval *ex TSRMLS_DC)
+static void php_http_exception_hook(zval *ex)
 {
        if (ex) {
 {
        if (ex) {
-               zval *m = zend_read_property(Z_OBJCE_P(ex), ex, "message", lenof("message"), 0 TSRMLS_CC);
+               zval *m = zend_read_property(Z_OBJCE_P(ex), ex, "message", lenof("message"), 0);
                fprintf(stderr, "*** Threw exception '%s'\n", Z_STRVAL_P(m));
        } else {
                fprintf(stderr, "*** Threw NULL exception\n");
                fprintf(stderr, "*** Threw exception '%s'\n", Z_STRVAL_P(m));
        } else {
                fprintf(stderr, "*** Threw NULL exception\n");
@@ -46,7 +46,7 @@ PHP_MINIT_FUNCTION(http_exception)
        zend_class_entry *cep, ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Exception", NULL);
        zend_class_entry *cep, ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Exception", NULL);
-       php_http_exception_interface_class_entry = zend_register_internal_interface(&ce TSRMLS_CC);
+       php_http_exception_interface_class_entry = zend_register_internal_interface(&ce);
        
        /*
         * Would be great to only have a few exceptions and rather more identifying
        
        /*
         * Would be great to only have a few exceptions and rather more identifying
@@ -55,56 +55,56 @@ PHP_MINIT_FUNCTION(http_exception)
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "RuntimeException", NULL);
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "RuntimeException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_runtime_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "UnexpectedValueException", NULL);
        php_http_exception_runtime_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "UnexpectedValueException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_UnexpectedValueException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_UnexpectedValueException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_unexpected_val_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadMethodCallException", NULL);
        php_http_exception_unexpected_val_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadMethodCallException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_BadMethodCallException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_BadMethodCallException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_method_call_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "InvalidArgumentException", NULL);
        php_http_exception_bad_method_call_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "InvalidArgumentException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_InvalidArgumentException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_InvalidArgumentException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_invalid_arg_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadHeaderException", NULL);
        php_http_exception_invalid_arg_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadHeaderException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_header_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadUrlException", NULL);
        php_http_exception_bad_header_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadUrlException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_url_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadMessageException", NULL);
        php_http_exception_bad_url_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadMessageException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_message_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadConversionException", NULL);
        php_http_exception_bad_message_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadConversionException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_conversion_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadQueryStringException", NULL);
        php_http_exception_bad_conversion_class_entry = cep;
 
        memset(&ce, 0, sizeof(ce));
        INIT_NS_CLASS_ENTRY(ce, "http\\Exception", "BadQueryStringException", NULL);
-       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException, NULL TSRMLS_CC);
-       zend_class_implements(cep TSRMLS_CC, 1, php_http_exception_interface_class_entry);
+       cep = zend_register_internal_class_ex(&ce, spl_ce_DomainException);
+       zend_class_implements(cep, 1, php_http_exception_interface_class_entry);
        php_http_exception_bad_querystring_class_entry = cep;
 
 #if PHP_HTTP_DBG_EXCEPTIONS
        php_http_exception_bad_querystring_class_entry = cep;
 
 #if PHP_HTTP_DBG_EXCEPTIONS
index 969a3514872392c95ccd72ed8920920690333837..eaf7a13c2812ba31d0ea3806cbbf51edcc3e6d46 100644 (file)
 
 /* short hand for zend_throw_exception_ex */
 #define php_http_throw(e, fmt, ...) \
 
 /* short hand for zend_throw_exception_ex */
 #define php_http_throw(e, fmt, ...) \
-       zend_throw_exception_ex(php_http_exception_ ##e## _class_entry, 0 TSRMLS_CC, fmt, __VA_ARGS__)
+       zend_throw_exception_ex(php_http_exception_ ##e## _class_entry, 0, fmt, __VA_ARGS__)
 
 /* wrap a call with replaced zend_error_handling */
 #define php_http_expect(test, e, fail) \
        do { \
                zend_error_handling __zeh; \
 
 /* wrap a call with replaced zend_error_handling */
 #define php_http_expect(test, e, fail) \
        do { \
                zend_error_handling __zeh; \
-               zend_replace_error_handling(EH_THROW, php_http_exception_ ##e## _class_entry, &__zeh TSRMLS_CC); \
+               zend_replace_error_handling(EH_THROW, php_http_exception_ ##e## _class_entry, &__zeh); \
                if (!(test)) { \
                if (!(test)) { \
-                       zend_restore_error_handling(&__zeh TSRMLS_CC); \
+                       zend_restore_error_handling(&__zeh); \
                        fail; \
                } \
                        fail; \
                } \
-               zend_restore_error_handling(&__zeh TSRMLS_CC); \
+               zend_restore_error_handling(&__zeh); \
        } while(0)
 
 PHP_HTTP_API zend_class_entry *php_http_exception_interface_class_entry;
        } while(0)
 
 PHP_HTTP_API zend_class_entry *php_http_exception_interface_class_entry;
index b6d967b6f756eb27f62e57920086fabfa5655315..084d98918846ab7a3fd3e1ac2d10c8c68e14d988 100644 (file)
@@ -18,7 +18,7 @@
 
 PHP_MINIT_FUNCTION(http_filter)
 {
 
 PHP_MINIT_FUNCTION(http_filter)
 {
-       php_stream_filter_register_factory("http.*", &php_http_filter_factory TSRMLS_CC);
+       php_stream_filter_register_factory("http.*", &php_http_filter_factory);
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
@@ -27,8 +27,8 @@ PHP_MINIT_FUNCTION(http_filter)
        php_stream_filter *this, \
        php_stream_bucket_brigade *buckets_in, \
        php_stream_bucket_brigade *buckets_out, \
        php_stream_filter *this, \
        php_stream_bucket_brigade *buckets_in, \
        php_stream_bucket_brigade *buckets_out, \
-       size_t *bytes_consumed, int flags \
-       TSRMLS_DC
+       size_t *bytes_consumed, \
+       int flags
 #define PHP_HTTP_FILTER_OP(filter) \
        http_filter_op_ ##filter
 #define PHP_HTTP_FILTER_OPS(filter) \
 #define PHP_HTTP_FILTER_OP(filter) \
        http_filter_op_ ##filter
 #define PHP_HTTP_FILTER_OPS(filter) \
@@ -36,7 +36,7 @@ PHP_MINIT_FUNCTION(http_filter)
 #define PHP_HTTP_FILTER_DTOR(filter) \
        http_filter_ ##filter## _dtor
 #define PHP_HTTP_FILTER_DESTRUCTOR(filter) \
 #define PHP_HTTP_FILTER_DTOR(filter) \
        http_filter_ ##filter## _dtor
 #define PHP_HTTP_FILTER_DESTRUCTOR(filter) \
-       void PHP_HTTP_FILTER_DTOR(filter)(php_stream_filter *this TSRMLS_DC)
+       void PHP_HTTP_FILTER_DTOR(filter)(php_stream_filter *this)
 #define PHP_HTTP_FILTER_FUNC(filter) \
        http_filter_ ##filter
 #define PHP_HTTP_FILTER_FUNCTION(filter) \
 #define PHP_HTTP_FILTER_FUNC(filter) \
        http_filter_ ##filter
 #define PHP_HTTP_FILTER_FUNCTION(filter) \
@@ -61,13 +61,13 @@ PHP_MINIT_FUNCTION(http_filter)
                } \
                memcpy(__data, data, length); \
                \
                } \
                memcpy(__data, data, length); \
                \
-               __buck = php_stream_bucket_new(stream, __data, length, 1, this->is_persistent TSRMLS_CC); \
+               __buck = php_stream_bucket_new(stream, __data, length, 1, this->is_persistent); \
                if (!__buck) { \
                        pefree(__data, this->is_persistent); \
                        return PSFS_ERR_FATAL; \
                } \
                \
                if (!__buck) { \
                        pefree(__data, this->is_persistent); \
                        return PSFS_ERR_FATAL; \
                } \
                \
-               php_stream_bucket_append(buckets_out, __buck TSRMLS_CC); \
+               php_stream_bucket_append(buckets_out, __buck); \
        }
 
 typedef struct _http_chunked_decode_filter_buffer_t {
        }
 
 typedef struct _http_chunked_decode_filter_buffer_t {
@@ -81,7 +81,7 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_decode)
 {
        int out_avail = 0;
        php_stream_bucket *ptr, *nxt;
 {
        int out_avail = 0;
        php_stream_bucket *ptr, *nxt;
-       PHP_HTTP_FILTER_BUFFER(chunked_decode) *buffer = (PHP_HTTP_FILTER_BUFFER(chunked_decode) *) (this->abstract);
+       PHP_HTTP_FILTER_BUFFER(chunked_decode) *buffer = Z_PTR(this->abstract);
        
        if (bytes_consumed) {
                *bytes_consumed = 0;
        
        if (bytes_consumed) {
                *bytes_consumed = 0;
@@ -98,8 +98,8 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_decode)
                }
 
                nxt = ptr->next;
                }
 
                nxt = ptr->next;
-               php_stream_bucket_unlink(ptr TSRMLS_CC);
-               php_stream_bucket_delref(ptr TSRMLS_CC);
+               php_stream_bucket_unlink(ptr);
+               php_stream_bucket_delref(ptr);
        }
        
        if (!php_http_buffer_fix(PHP_HTTP_BUFFER(buffer))) {
        }
        
        if (!php_http_buffer_fix(PHP_HTTP_BUFFER(buffer))) {
@@ -185,7 +185,7 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_decode)
                                        php_http_buffer_cut(PHP_HTTP_BUFFER(buffer), 0, eolstr + eollen - PHP_HTTP_BUFFER(buffer)->data);
                                        /* buffer->hexlen is 0 now or contains the size of the next chunk */
                                        if (!buffer->hexlen) {
                                        php_http_buffer_cut(PHP_HTTP_BUFFER(buffer), 0, eolstr + eollen - PHP_HTTP_BUFFER(buffer)->data);
                                        /* buffer->hexlen is 0 now or contains the size of the next chunk */
                                        if (!buffer->hexlen) {
-                                               php_stream_notify_info(stream->context, PHP_STREAM_NOTIFY_COMPLETED, NULL, 0);
+                                               php_stream_notify_info(PHP_STREAM_CONTEXT(stream), PHP_STREAM_NOTIFY_COMPLETED, NULL, 0);
                                                break;
                                        }
                                        /* continue */
                                                break;
                                        }
                                        /* continue */
@@ -211,7 +211,7 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_decode)
 
 static PHP_HTTP_FILTER_DESTRUCTOR(chunked_decode)
 {
 
 static PHP_HTTP_FILTER_DESTRUCTOR(chunked_decode)
 {
-       PHP_HTTP_FILTER_BUFFER(chunked_decode) *b = (PHP_HTTP_FILTER_BUFFER(chunked_decode) *) (this->abstract);
+       PHP_HTTP_FILTER_BUFFER(chunked_decode) *b = Z_PTR(this->abstract);
        
        php_http_buffer_dtor(PHP_HTTP_BUFFER(b));
        pefree(b, this->is_persistent);
        
        php_http_buffer_dtor(PHP_HTTP_BUFFER(b));
        pefree(b, this->is_persistent);
@@ -239,7 +239,7 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_encode)
 #endif
                
                nxt = ptr->next;
 #endif
                
                nxt = ptr->next;
-               php_stream_bucket_unlink(ptr TSRMLS_CC);
+               php_stream_bucket_unlink(ptr);
                php_http_buffer_appendf(&buf, "%lx" PHP_HTTP_CRLF, (long unsigned int) ptr->buflen);
                php_http_buffer_append(&buf, ptr->buf, ptr->buflen);
                php_http_buffer_appends(&buf, PHP_HTTP_CRLF);
                php_http_buffer_appendf(&buf, "%lx" PHP_HTTP_CRLF, (long unsigned int) ptr->buflen);
                php_http_buffer_append(&buf, ptr->buf, ptr->buflen);
                php_http_buffer_appends(&buf, PHP_HTTP_CRLF);
@@ -248,7 +248,7 @@ static PHP_HTTP_FILTER_FUNCTION(chunked_encode)
                NEW_BUCKET(buf.data, buf.used);
                /* reset */
                php_http_buffer_reset(&buf);
                NEW_BUCKET(buf.data, buf.used);
                /* reset */
                php_http_buffer_reset(&buf);
-               php_stream_bucket_delref(ptr TSRMLS_CC);
+               php_stream_bucket_delref(ptr);
        }
 
        /* free buffer */
        }
 
        /* free buffer */
@@ -281,7 +281,7 @@ static PHP_HTTP_FILTER_OPS(chunked_encode) = {
 static PHP_HTTP_FILTER_FUNCTION(zlib)
 {
        php_stream_bucket *ptr, *nxt;
 static PHP_HTTP_FILTER_FUNCTION(zlib)
 {
        php_stream_bucket *ptr, *nxt;
-       PHP_HTTP_FILTER_BUFFER(zlib) *buffer = (PHP_HTTP_FILTER_BUFFER(zlib) *) this->abstract;
+       PHP_HTTP_FILTER_BUFFER(zlib) *buffer = Z_PTR(this->abstract);
        
        if (bytes_consumed) {
                *bytes_consumed = 0;
        
        if (bytes_consumed) {
                *bytes_consumed = 0;
@@ -301,7 +301,7 @@ static PHP_HTTP_FILTER_FUNCTION(zlib)
 #endif
                
                nxt = ptr->next;
 #endif
                
                nxt = ptr->next;
-               php_stream_bucket_unlink(ptr TSRMLS_CC);
+               php_stream_bucket_unlink(ptr);
                php_http_encoding_stream_update(buffer, ptr->buf, ptr->buflen, &encoded, &encoded_len);
                
 #if DBG_FILTER
                php_http_encoding_stream_update(buffer, ptr->buf, ptr->buflen, &encoded, &encoded_len);
                
 #if DBG_FILTER
@@ -314,7 +314,7 @@ static PHP_HTTP_FILTER_FUNCTION(zlib)
                        }
                        efree(encoded);
                }
                        }
                        efree(encoded);
                }
-               php_stream_bucket_delref(ptr TSRMLS_CC);
+               php_stream_bucket_delref(ptr);
        }
 
        /* flush & close */
        }
 
        /* flush & close */
@@ -358,7 +358,7 @@ static PHP_HTTP_FILTER_FUNCTION(zlib)
 }
 static PHP_HTTP_FILTER_DESTRUCTOR(zlib)
 {
 }
 static PHP_HTTP_FILTER_DESTRUCTOR(zlib)
 {
-       PHP_HTTP_FILTER_BUFFER(zlib) *buffer = (PHP_HTTP_FILTER_BUFFER(zlib) *) this->abstract;
+       PHP_HTTP_FILTER_BUFFER(zlib) *buffer = Z_PTR(this->abstract);
        php_http_encoding_stream_free(&buffer);
 }
 
        php_http_encoding_stream_free(&buffer);
 }
 
@@ -374,28 +374,22 @@ static PHP_HTTP_FILTER_OPS(inflate) = {
        "http.inflate"
 };
 
        "http.inflate"
 };
 
-static php_stream_filter *http_filter_create(const char *name, zval *params, int p TSRMLS_DC)
+static php_stream_filter *http_filter_create(const char *name, zval *params, int p)
 {
 {
-       zval **tmp = &params;
+       zval *tmp = params;
        php_stream_filter *f = NULL;
        int flags = p ? PHP_HTTP_ENCODING_STREAM_PERSISTENT : 0;
        
        if (params) {
                switch (Z_TYPE_P(params)) {
        php_stream_filter *f = NULL;
        int flags = p ? PHP_HTTP_ENCODING_STREAM_PERSISTENT : 0;
        
        if (params) {
                switch (Z_TYPE_P(params)) {
-                       case IS_ARRAY:
-                       case IS_OBJECT:
-                               if (SUCCESS != zend_hash_find(HASH_OF(params), "flags", sizeof("flags"), (void *) &tmp)) {
-                                       break;
-                               }
-                               /* no break */
-                       default:
-                       {
-                               zval *num = php_http_ztyp(IS_LONG, *tmp);
-                               
-                               flags |= (Z_LVAL_P(num) & 0x0fffffff);
-                               zval_ptr_dtor(&num);
-
+               case IS_ARRAY:
+               case IS_OBJECT:
+                       if (!(tmp = zend_hash_str_find(HASH_OF(params), ZEND_STRL("flags")))) {
+                               break;
                        }
                        }
+                       /* no break */
+               default:
+                       flags |= zval_get_long(tmp) & 0x0fffffff;
                        break;
                }
        }
                        break;
                }
        }
@@ -418,7 +412,7 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int
        if (!strcasecmp(name, "http.inflate")) {
                PHP_HTTP_FILTER_BUFFER(zlib) *b = NULL;
                
        if (!strcasecmp(name, "http.inflate")) {
                PHP_HTTP_FILTER_BUFFER(zlib) *b = NULL;
                
-               if ((b = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_inflate_ops(), flags TSRMLS_CC))) {
+               if ((b = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_inflate_ops(), flags))) {
                        if (!(f = php_stream_filter_alloc(&PHP_HTTP_FILTER_OP(inflate), b, p))) {
                                php_http_encoding_stream_free(&b);
                        }
                        if (!(f = php_stream_filter_alloc(&PHP_HTTP_FILTER_OP(inflate), b, p))) {
                                php_http_encoding_stream_free(&b);
                        }
@@ -428,7 +422,7 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int
        if (!strcasecmp(name, "http.deflate")) {
                PHP_HTTP_FILTER_BUFFER(zlib) *b = NULL;
                
        if (!strcasecmp(name, "http.deflate")) {
                PHP_HTTP_FILTER_BUFFER(zlib) *b = NULL;
                
-               if ((b = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_deflate_ops(), flags TSRMLS_CC))) {
+               if ((b = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_deflate_ops(), flags))) {
                        if (!(f = php_stream_filter_alloc(&PHP_HTTP_FILTER_OP(deflate), b, p))) {
                                php_http_encoding_stream_free(&b);
                        }
                        if (!(f = php_stream_filter_alloc(&PHP_HTTP_FILTER_OP(deflate), b, p))) {
                                php_http_encoding_stream_free(&b);
                        }
index 92a2de4e49a96c31d076a0e1e77d61534f006d85..709b85bb3cea22f528bd3b13bb2adaeaa77ec16e 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-STATUS php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC)
+ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data)
 {
        php_http_header_parser_t ctx;
        php_http_buffer_t buf;
 {
        php_http_header_parser_t ctx;
        php_http_buffer_t buf;
@@ -43,16 +43,17 @@ STATUS php_http_header_parse(const char *header, size_t length, HashTable *heade
 
 void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC)
 {
 
 void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC)
 {
-       HashPosition pos1, pos2;
-       php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-       zval **header, **single_header;
-
-       FOREACH_HASH_KEYVAL(pos1, headers, key, header) {
-               if (key.type == HASH_KEY_IS_STRING) {
-                       if (key.len == sizeof("Set-Cookie") && !strcasecmp(key.str, "Set-Cookie") && Z_TYPE_PP(header) == IS_ARRAY) {
-                               FOREACH_VAL(pos2, *header, single_header) {
-                                       if (Z_TYPE_PP(single_header) == IS_ARRAY) {
-                                               php_http_cookie_list_t *cookie = php_http_cookie_list_from_struct(NULL, *single_header TSRMLS_CC);
+       php_http_arrkey_t key;
+       zval *header, *single_header;
+
+       ZEND_HASH_FOREACH_KEY_VAL(headers, key.h, key.key, header)
+       {
+               if (key.key) {
+                       if (zend_string_equals_literal(key.key, "Set-Cookie") && Z_TYPE_P(header) == IS_ARRAY) {
+                               ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(header), single_header)
+                               {
+                                       if (Z_TYPE_P(single_header) == IS_ARRAY) {
+                                               php_http_cookie_list_t *cookie = php_http_cookie_list_from_struct(NULL, single_header);
 
                                                if (cookie) {
                                                        char *buf;
 
                                                if (cookie) {
                                                        char *buf;
@@ -64,20 +65,22 @@ void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pa
                                                        efree(buf);
                                                }
                                        } else {
                                                        efree(buf);
                                                }
                                        } else {
-                                               zval *strval = php_http_header_value_to_string(*single_header TSRMLS_CC);
+                                               zend_string *zs = php_http_header_value_to_string(single_header);
 
 
-                                               cb(cb_arg, crlf ? "Set-Cookie: %s" PHP_HTTP_CRLF : "Set-Cookie: %s", Z_STRVAL_P(strval));
-                                               zval_ptr_dtor(&strval);
+                                               cb(cb_arg, crlf ? "Set-Cookie: %s" PHP_HTTP_CRLF : "Set-Cookie: %s", zs->val);
+                                               zend_string_release(zs);
                                        }
                                }
                                        }
                                }
-                       } else {
-                               zval *strval = php_http_header_value_to_string(*header TSRMLS_CC);
-
-                               cb(cb_arg, crlf ? "%s: %s" PHP_HTTP_CRLF : "%s: %s", key.str, Z_STRVAL_P(strval));
-                               zval_ptr_dtor(&strval);
+                               ZEND_HASH_FOREACH_END();
                        }
                        }
+               } else {
+                       zend_string *zs = php_http_header_value_to_string(header);
+
+                       cb(cb_arg, crlf ? "%s: %s" PHP_HTTP_CRLF : "%s: %s", key.key->val, zs->val);
+                       zend_string_release(zs);
                }
        }
                }
        }
+       ZEND_HASH_FOREACH_END();
 }
 
 void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC)
 }
 
 void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC)
@@ -85,33 +88,37 @@ void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS
        php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str TSRMLS_CC);
 }
 
        php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str TSRMLS_CC);
 }
 
-zval *php_http_header_value_to_string(zval *header TSRMLS_DC)
+zend_string *php_http_header_value_array_to_string(zval *header)
 {
 {
-       zval *ret;
-
-       if (Z_TYPE_P(header) == IS_BOOL) {
-               MAKE_STD_ZVAL(ret);
-               ZVAL_STRING(ret, Z_BVAL_P(header) ? "true" : "false", 1);
-       } else if (Z_TYPE_P(header) == IS_ARRAY) {
-               zval **val;
-               HashPosition pos;
-               php_http_buffer_t str;
-
-               php_http_buffer_init(&str);
-               MAKE_STD_ZVAL(ret);
-               FOREACH_VAL(pos,header, val) {
-                       zval *strval = php_http_header_value_to_string(*val TSRMLS_CC);
-
-                       php_http_buffer_appendf(&str, str.used ? ", %s":"%s", Z_STRVAL_P(strval));
-                       zval_ptr_dtor(&strval);
-               }
-               php_http_buffer_fix(&str);
-               ZVAL_STRINGL(ret, str.data, str.used, 0);
-       } else  {
-               ret = php_http_zsep(1, IS_STRING, header);
+       zval *val;
+       php_http_buffer_t str;
+
+       php_http_buffer_init(&str);
+       ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(header), val)
+       {
+               zend_string *zs = php_http_header_value_to_string(val);
+
+               php_http_buffer_appendf(&str, str.used ? ", %s":"%s", zs->val);
+               zend_string_release(zs);
        }
        }
+       ZEND_HASH_FOREACH_END();
+       php_http_buffer_fix(&str);
+
+       return php_http_cs2zs(str.data, str.used);
+}
 
 
-       return ret;
+zend_string *php_http_header_value_to_string(zval *header)
+{
+       switch (Z_TYPE_P(header)) {
+       case IS_TRUE:
+               return zend_string_init(ZEND_STRL("true"), 0);
+       case IS_FALSE:
+               return zend_string_init(ZEND_STRL("false"), 0);
+       case IS_ARRAY:
+               return php_http_header_value_array_to_string(header);
+       default:
+               return zval_get_string(header);
+       }
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader___construct, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader___construct, 0, 0, 0)
@@ -121,17 +128,17 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, __construct)
 {
        char *name_str = NULL, *value_str = NULL;
 PHP_METHOD(HttpHeader, __construct)
 {
        char *name_str = NULL, *value_str = NULL;
-       int name_len = 0, value_len = 0;
+       size_t name_len = 0, value_len = 0;
 
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", &name_str, &name_len, &value_str, &value_len), invalid_arg, return);
 
        if (name_str && name_len) {
                char *pretty_str = estrndup(name_str, name_len);
 
        if (name_str && name_len) {
                char *pretty_str = estrndup(name_str, name_len);
-               zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len TSRMLS_CC);
+               zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len);
                efree(pretty_str);
        }
        if (value_str && value_len) {
                efree(pretty_str);
        }
        if (value_str && value_len) {
-               zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("value"), value_str, value_len TSRMLS_CC);
+               zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("value"), value_str, value_len);
        }
 }
 
        }
 }
 
@@ -141,22 +148,23 @@ PHP_METHOD(HttpHeader, serialize)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
                php_http_buffer_t buf;
 {
        if (SUCCESS == zend_parse_parameters_none()) {
                php_http_buffer_t buf;
-               zval *zname, *zvalue;
+               zend_string *zs;
 
                php_http_buffer_init(&buf);
 
                php_http_buffer_init(&buf);
-               zname = php_http_ztyp(IS_STRING, zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0 TSRMLS_CC));
-               php_http_buffer_append(&buf, Z_STRVAL_P(zname), Z_STRLEN_P(zname));
-               zval_ptr_dtor(&zname);
-               zvalue = php_http_ztyp(IS_STRING, zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0 TSRMLS_CC));
-               if (Z_STRLEN_P(zvalue)) {
+               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0));
+               php_http_buffer_appendz(&buf, zs);
+               zend_string_release(zs);
+
+               zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+               if (zs->len) {
                        php_http_buffer_appends(&buf, ": ");
                        php_http_buffer_appends(&buf, ": ");
-                       php_http_buffer_append(&buf, Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue));
+                       php_http_buffer_appendz(&buf, zs);
                } else {
                        php_http_buffer_appends(&buf, ":");
                }
                } else {
                        php_http_buffer_appends(&buf, ":");
                }
-               zval_ptr_dtor(&zvalue);
+               zend_string_release(zs);
 
 
-               RETURN_PHP_HTTP_BUFFER_VAL(&buf);
+               RETURN_STR(php_http_cs2zs(buf.data, buf.used));
        }
        RETURN_EMPTY_STRING();
 }
        }
        RETURN_EMPTY_STRING();
 }
@@ -167,34 +175,31 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, unserialize)
 {
        char *serialized_str;
 PHP_METHOD(HttpHeader, unserialize)
 {
        char *serialized_str;
-       int serialized_len;
+       size_t serialized_len;
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_str, &serialized_len)) {
                HashTable ht;
 
                zend_hash_init(&ht, 1, NULL, ZVAL_PTR_DTOR, 0);
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_str, &serialized_len)) {
                HashTable ht;
 
                zend_hash_init(&ht, 1, NULL, ZVAL_PTR_DTOR, 0);
-               if (SUCCESS == php_http_header_parse(serialized_str, serialized_len, &ht, NULL, NULL TSRMLS_CC)) {
+               if (SUCCESS == php_http_header_parse(serialized_str, serialized_len, &ht, NULL, NULL)) {
                        if (zend_hash_num_elements(&ht)) {
                        if (zend_hash_num_elements(&ht)) {
-                               zval **val, *cpy;
-                               char *str;
-                               uint len;
-                               ulong idx;
+                               zend_string *zs, *key;
+                               zend_ulong idx;
 
                                zend_hash_internal_pointer_reset(&ht);
 
                                zend_hash_internal_pointer_reset(&ht);
-                               switch (zend_hash_get_current_key_ex(&ht, &str, &len, &idx, 0, NULL)) {
+                               switch (zend_hash_get_current_key_ex(&ht, &key, &idx, NULL)) {
                                        case HASH_KEY_IS_STRING:
                                        case HASH_KEY_IS_STRING:
-                                               zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("name"), str, len - 1 TSRMLS_CC);
+                                               zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("name"), key);
                                                break;
                                        case HASH_KEY_IS_LONG:
                                                break;
                                        case HASH_KEY_IS_LONG:
-                                               zend_update_property_long(php_http_header_class_entry, getThis(), ZEND_STRL("name"), idx TSRMLS_CC);
+                                               zend_update_property_long(php_http_header_class_entry, getThis(), ZEND_STRL("name"), idx);
                                                break;
                                        default:
                                                break;
                                }
                                                break;
                                        default:
                                                break;
                                }
-                               zend_hash_get_current_data(&ht, (void *) &val);
-                               cpy = php_http_zsep(1, IS_STRING, *val);
-                               zend_update_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), cpy TSRMLS_CC);
-                               zval_ptr_dtor(&cpy);
+                               zs = zval_get_string(zend_hash_get_current_data(&ht));
+                               zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("value"), zs);
+                               zend_string_release(zs);
                        }
                }
                zend_hash_destroy(&ht);
                        }
                }
                zend_hash_destroy(&ht);
@@ -209,17 +214,17 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, match)
 {
        char *val_str;
 PHP_METHOD(HttpHeader, match)
 {
        char *val_str;
-       int val_len;
-       long flags = PHP_HTTP_MATCH_LOOSE;
-       zval *zvalue;
+       size_t val_len;
+       zend_long flags = PHP_HTTP_MATCH_LOOSE;
+       zend_string *zs;
 
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &val_str, &val_len, &flags)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &val_str, &val_len, &flags)) {
                return;
        }
 
                return;
        }
 
-       zvalue = php_http_ztyp(IS_STRING, zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0 TSRMLS_CC));
-       RETVAL_BOOL(php_http_match(Z_STRVAL_P(zvalue), val_str, flags));
-       zval_ptr_dtor(&zvalue);
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+       RETVAL_BOOL(php_http_match(zs->val, val_str, flags));
+       zend_string_release(zs);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_negotiate, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_negotiate, 0, 0, 1)
@@ -229,11 +234,12 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, negotiate)
 {
        HashTable *supported, *rs;
 PHP_METHOD(HttpHeader, negotiate)
 {
        HashTable *supported, *rs;
-       zval *zname, *zvalue, *rs_array = NULL;
+       zval *rs_array = NULL;
+       zend_string *zs;
        char *sep_str = NULL;
        size_t sep_len = 0;
 
        char *sep_str = NULL;
        size_t sep_len = 0;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H|z", &supported, &rs_array)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "H|z", &supported, &rs_array)) {
                return;
        }
        if (rs_array) {
                return;
        }
        if (rs_array) {
@@ -241,23 +247,23 @@ PHP_METHOD(HttpHeader, negotiate)
                array_init(rs_array);
        }
 
                array_init(rs_array);
        }
 
-       zname = php_http_ztyp(IS_STRING, zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0 TSRMLS_CC));
-       if (!strcasecmp(Z_STRVAL_P(zname), "Accept")) {
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0));
+       if (zend_string_equals_literal(zs, "Accept")) {
                sep_str = "/";
                sep_len = 1;
                sep_str = "/";
                sep_len = 1;
-       } else if (!strcasecmp(Z_STRVAL_P(zname), "Accept-Language")) {
+       } else if (zend_string_equals_literal(zs, "Accept-Language")) {
                sep_str = "-";
                sep_len = 1;
        }
                sep_str = "-";
                sep_len = 1;
        }
-       zval_ptr_dtor(&zname);
+       zend_string_release(zs);
 
 
-       zvalue = php_http_ztyp(IS_STRING, zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0 TSRMLS_CC));
-       if ((rs = php_http_negotiate(Z_STRVAL_P(zvalue), Z_STRLEN_P(zvalue), supported, sep_str, sep_len TSRMLS_CC))) {
+       zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
+       if ((rs = php_http_negotiate(zs->val, zs->len, supported, sep_str, sep_len))) {
                PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(rs, supported, rs_array);
        } else {
                PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array);
        }
                PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(rs, supported, rs_array);
        } else {
                PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array);
        }
-       zval_ptr_dtor(&zvalue);
+       zend_string_release(zs);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_getParams, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_getParams, 0, 0, 0)
@@ -268,22 +274,20 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_getParams, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, getParams)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, getParams)
 {
-       zval zctor, *zparams_obj, **zargs = NULL;
+       zval zctor, zparams_obj, *zargs = NULL;
        
        
-       INIT_PZVAL(&zctor);
-       ZVAL_STRINGL(&zctor, "__construct", lenof("__construct"), 0);
+       ZVAL_STRINGL(&zctor, "__construct", lenof("__construct"));
        
        
-       MAKE_STD_ZVAL(zparams_obj);
-       object_init_ex(zparams_obj, php_http_params_class_entry);
+       object_init_ex(&zparams_obj, php_http_params_class_entry);
        
        
-       zargs = (zval **) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval *));
-       zargs[0] = zend_read_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL("value"), 0 TSRMLS_CC);
+       zargs = (zval *) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval));
+       ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0));
        if (ZEND_NUM_ARGS()) {
                zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]);
        }
        
        if (ZEND_NUM_ARGS()) {
                zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]);
        }
        
-       if (SUCCESS == call_user_function(NULL, &zparams_obj, &zctor, return_value, ZEND_NUM_ARGS()+1, zargs TSRMLS_CC)) {
-               RETVAL_ZVAL(zparams_obj, 0, 1);
+       if (SUCCESS == call_user_function(NULL, &zparams_obj, &zctor, return_value, ZEND_NUM_ARGS()+1, zargs)) {
+               RETVAL_ZVAL(&zparams_obj, 0, 1);
        }
        
        if (zargs) {
        }
        
        if (zargs) {
@@ -298,47 +302,43 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpHeader, parse)
 {
        char *header_str;
 PHP_METHOD(HttpHeader, parse)
 {
        char *header_str;
-       int header_len;
+       size_t header_len;
        zend_class_entry *ce = NULL;
 
        zend_class_entry *ce = NULL;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C", &header_str, &header_len, &ce)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|C", &header_str, &header_len, &ce)) {
                array_init(return_value);
 
                array_init(return_value);
 
-               if (SUCCESS != php_http_header_parse(header_str, header_len, Z_ARRVAL_P(return_value), NULL, NULL TSRMLS_CC)) {
+               if (SUCCESS != php_http_header_parse(header_str, header_len, Z_ARRVAL_P(return_value), NULL, NULL)) {
                        zval_dtor(return_value);
                        RETURN_FALSE;
                } else {
                        if (ce && instanceof_function(ce, php_http_header_class_entry TSRMLS_CC)) {
                        zval_dtor(return_value);
                        RETURN_FALSE;
                } else {
                        if (ce && instanceof_function(ce, php_http_header_class_entry TSRMLS_CC)) {
-                               HashPosition pos;
-                               php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-                               zval **val;
+                               php_http_arrkey_t key;
+                               zval *val;
 
 
-                               FOREACH_KEYVAL(pos, return_value, key, val) {
-                                       zval *zho, *zkey, *zvalue;
+                               ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(return_value), key.h, key.key, val)
+                               {
+                                       zval zkey, zho;
 
 
-                                       Z_ADDREF_PP(val);
-                                       zvalue = *val;
-
-                                       MAKE_STD_ZVAL(zkey);
-                                       if (key.type == HASH_KEY_IS_LONG) {
-                                               ZVAL_LONG(zkey, key.num);
+                                       if (key.key) {
+                                               ZVAL_STR_COPY(&zkey, key.key);
                                        } else {
                                        } else {
-                                               ZVAL_STRINGL(zkey, key.str, key.len - 1, 1);
+                                               ZVAL_LONG(&zkey, key.h);
                                        }
 
                                        }
 
-                                       MAKE_STD_ZVAL(zho);
-                                       object_init_ex(zho, ce);
-                                       zend_call_method_with_2_params(&zho, ce, NULL, "__construct", NULL, zkey, zvalue);
+                                       object_init_ex(&zho, ce);
+                                       Z_TRY_ADDREF_P(val);
+                                       zend_call_method_with_2_params(&zho, ce, NULL, "__construct", NULL, &zkey, val);
+                                       zval_ptr_dtor(val);
+                                       zval_ptr_dtor(&zkey);
 
 
-                                       if (key.type == HASH_KEY_IS_LONG) {
-                                               zend_hash_index_update(Z_ARRVAL_P(return_value), key.num, (void *) &zho, sizeof(zval *), NULL);
+                                       if (key.key) {
+                                               add_assoc_zval_ex(return_value, key.key->val, key.key->len, &zho);
                                        } else {
                                        } else {
-                                               zend_hash_update(Z_ARRVAL_P(return_value), key.str, key.len, (void *) &zho, sizeof(zval *), NULL);
+                                               add_index_zval(return_value, key.h, &zho);
                                        }
                                        }
-
-                                       zval_ptr_dtor(&zvalue);
-                                       zval_ptr_dtor(&zkey);
                                }
                                }
+                               ZEND_HASH_FOREACH_END();
                        }
                }
        }
                        }
                }
        }
@@ -364,15 +364,15 @@ PHP_MINIT_FUNCTION(http_header)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Header", php_http_header_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Header", php_http_header_methods);
-       php_http_header_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-       zend_class_implements(php_http_header_class_entry TSRMLS_CC, 1, zend_ce_serializable);
-       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_LOOSE"), PHP_HTTP_MATCH_LOOSE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_CASE"), PHP_HTTP_MATCH_CASE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_WORD"), PHP_HTTP_MATCH_WORD TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_FULL"), PHP_HTTP_MATCH_FULL TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_STRICT"), PHP_HTTP_MATCH_STRICT TSRMLS_CC);
-       zend_declare_property_null(php_http_header_class_entry, ZEND_STRL("name"), ZEND_ACC_PUBLIC TSRMLS_CC);
-       zend_declare_property_null(php_http_header_class_entry, ZEND_STRL("value"), ZEND_ACC_PUBLIC TSRMLS_CC);
+       php_http_header_class_entry = zend_register_internal_class(&ce);
+       zend_class_implements(php_http_header_class_entry, 1, zend_ce_serializable);
+       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_LOOSE"), PHP_HTTP_MATCH_LOOSE);
+       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_CASE"), PHP_HTTP_MATCH_CASE);
+       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_WORD"), PHP_HTTP_MATCH_WORD);
+       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_FULL"), PHP_HTTP_MATCH_FULL);
+       zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_STRICT"), PHP_HTTP_MATCH_STRICT);
+       zend_declare_property_null(php_http_header_class_entry, ZEND_STRL("name"), ZEND_ACC_PUBLIC);
+       zend_declare_property_null(php_http_header_class_entry, ZEND_STRL("value"), ZEND_ACC_PUBLIC);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index d420e3fdd54bdf06427554572e012b4e54cf1310..88ebd1048075e5faea6c606f4ef838ca5faa8e51 100644 (file)
 
 #include "php_http_info.h"
 
 
 #include "php_http_info.h"
 
-PHP_HTTP_API STATUS php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data);
 
 
-PHP_HTTP_API void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC);
-PHP_HTTP_API void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC);
+PHP_HTTP_API void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg);
+PHP_HTTP_API void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers);
 
 
-PHP_HTTP_API zval *php_http_header_value_to_string(zval *header TSRMLS_DC);
+PHP_HTTP_API zend_string *php_http_header_value_to_string(zval *header);
+PHP_HTTP_API zend_string *php_http_header_value_array_to_string(zval *header);
 
 PHP_HTTP_API zend_class_entry *php_http_header_class_entry;
 PHP_MINIT_FUNCTION(http_header);
 
 PHP_HTTP_API zend_class_entry *php_http_header_class_entry;
 PHP_MINIT_FUNCTION(http_header);
index df0837df2727430de080869760daa65f4f7b8969..65c0b24296bd8f6ddda1dcf2a23b87019d873b23 100644 (file)
@@ -26,15 +26,13 @@ static const php_http_header_parser_state_spec_t php_http_header_parser_states[]
                {PHP_HTTP_HEADER_PARSER_STATE_DONE,                     0}
 };
 
                {PHP_HTTP_HEADER_PARSER_STATE_DONE,                     0}
 };
 
-php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser TSRMLS_DC)
+php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser)
 {
        if (!parser) {
                parser = emalloc(sizeof(*parser));
        }
        memset(parser, 0, sizeof(*parser));
 
 {
        if (!parser) {
                parser = emalloc(sizeof(*parser));
        }
        memset(parser, 0, sizeof(*parser));
 
-       TSRMLS_SET_CTX(parser->ts);
-
        return parser;
 }
 
        return parser;
 }
 
@@ -92,10 +90,8 @@ void php_http_header_parser_free(php_http_header_parser_t **parser)
        }
 }
 
        }
 }
 
-STATUS php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg)
+php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg)
 {
 {
-       TSRMLS_FETCH_FROM_CTX(parser->ts);
-
        while (buffer->used || !php_http_header_parser_states[php_http_header_parser_state_is(parser)].need_data) {
 #if 0
                const char *state[] = {"START", "KEY", "VALUE", "HEADER_DONE", "DONE"};
        while (buffer->used || !php_http_header_parser_states[php_http_header_parser_state_is(parser)].need_data) {
 #if 0
                const char *state[] = {"START", "KEY", "VALUE", "HEADER_DONE", "DONE"};
@@ -126,10 +122,10 @@ STATUS php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_b
                                        /* end of headers */
                                        php_http_buffer_cut(buffer, 0, eol_len);
                                        php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_DONE);
                                        /* end of headers */
                                        php_http_buffer_cut(buffer, 0, eol_len);
                                        php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_DONE);
-                               } else if (php_http_info_parse(&parser->info, php_http_buffer_fix(buffer)->data TSRMLS_CC)) {
+                               } else if (php_http_info_parse(&parser->info, php_http_buffer_fix(buffer)->data)) {
                                        /* new message starting with request/response line */
                                        if (callback_func) {
                                        /* new message starting with request/response line */
                                        if (callback_func) {
-                                               callback_func(callback_arg, &headers, &parser->info TSRMLS_CC);
+                                               callback_func(callback_arg, &headers, &parser->info);
                                        }
                                        php_http_info_dtor(&parser->info);
                                        php_http_buffer_cut(buffer, 0, eol_str + eol_len - buffer->data);
                                        }
                                        php_http_info_dtor(&parser->info);
                                        php_http_buffer_cut(buffer, 0, eol_str + eol_len - buffer->data);
@@ -214,19 +210,19 @@ STATUS php_http_header_parser_parse(php_http_header_parser_t *parser, php_http_b
 
                        case PHP_HTTP_HEADER_PARSER_STATE_HEADER_DONE:
                                if (parser->_key.str && parser->_val.str) {
 
                        case PHP_HTTP_HEADER_PARSER_STATE_HEADER_DONE:
                                if (parser->_key.str && parser->_val.str) {
-                                       zval array, **exist;
+                                       zval tmp, *exist;
 
                                        if (!headers && callback_func) {
 
                                        if (!headers && callback_func) {
-                                               callback_func(callback_arg, &headers, NULL TSRMLS_CC);
+                                               callback_func(callback_arg, &headers, NULL);
                                        }
 
                                        }
 
-                                       INIT_PZVAL_ARRAY(&array, headers);
                                        php_http_pretty_key(parser->_key.str, parser->_key.len, 1, 1);
                                        php_http_pretty_key(parser->_key.str, parser->_key.len, 1, 1);
-                                       if (SUCCESS == zend_symtable_find(headers, parser->_key.str, parser->_key.len + 1, (void *) &exist)) {
-                                               convert_to_array(*exist);
-                                               add_next_index_stringl(*exist, parser->_val.str, parser->_val.len, 0);
+                                       if ((exist = zend_symtable_str_find(headers, parser->_key.str, parser->_key.len))) {
+                                               convert_to_array(exist);
+                                               add_next_index_str(exist, php_http_cs2zs(parser->_val.str, parser->_val.len));
                                        } else {
                                        } else {
-                                               add_assoc_stringl_ex(&array, parser->_key.str, parser->_key.len + 1, parser->_val.str, parser->_val.len, 0);
+                                               ZVAL_STR(&tmp, php_http_cs2zs(parser->_val.str, parser->_val.len));
+                                               zend_symtable_str_update(headers, parser->_key.str, parser->_key.len, &tmp);
                                        }
                                        parser->_val.str = NULL;
                                }
                                        }
                                        parser->_val.str = NULL;
                                }
index 4c60f6ef634b4b262eb9228855588816b19419d2..5b4993a459f070ed33fe27f2c40f8081f23c5e51 100644 (file)
@@ -38,12 +38,9 @@ typedef struct php_http_header_parser {
                char *str;
                size_t len;
        } _val;
                char *str;
                size_t len;
        } _val;
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_header_parser_t;
 
 } php_http_header_parser_t;
 
-PHP_HTTP_API php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser TSRMLS_DC);
+PHP_HTTP_API php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_push(php_http_header_parser_t *parser, unsigned argc, ...);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_is(php_http_header_parser_t *parser);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_pop(php_http_header_parser_t *parser);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_push(php_http_header_parser_t *parser, unsigned argc, ...);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_is(php_http_header_parser_t *parser);
 PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_pop(php_http_header_parser_t *parser);
index 7efd70ec7914426f697a3a7718984400e5f24253..f0fe7ad72bcc703b4e259a240498e72a4985e5af 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-php_http_info_t *php_http_info_init(php_http_info_t *i TSRMLS_DC)
+php_http_info_t *php_http_info_init(php_http_info_t *i)
 {
        if (!i) {
                i = emalloc(sizeof(*i));
 {
        if (!i) {
                i = emalloc(sizeof(*i));
@@ -49,7 +49,7 @@ void php_http_info_free(php_http_info_t **i)
        }
 }
 
        }
 }
 
-php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_header TSRMLS_DC)
+php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_header)
 {
        const char *end, *http;
        zend_bool free_info = !info;
 {
        const char *end, *http;
        zend_bool free_info = !info;
@@ -72,7 +72,7 @@ php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_head
        info = php_http_info_init(info TSRMLS_CC);
 
        /* and nothing than SPACE or NUL after HTTP/1.x */
        info = php_http_info_init(info TSRMLS_CC);
 
        /* and nothing than SPACE or NUL after HTTP/1.x */
-       if (!php_http_version_parse(&info->http.version, http TSRMLS_CC)
+       if (!php_http_version_parse(&info->http.version, http)
        ||      (http[lenof("HTTP/1.1")] && (!PHP_HTTP_IS_CTYPE(space, http[lenof("HTTP/1.1")])))) {
                if (free_info) {
                        php_http_info_free(&info);
        ||      (http[lenof("HTTP/1.1")] && (!PHP_HTTP_IS_CTYPE(space, http[lenof("HTTP/1.1")])))) {
                if (free_info) {
                        php_http_info_free(&info);
@@ -120,7 +120,7 @@ php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_head
                        while (' ' == *url) ++url;
                        while (' ' == *(http-1)) --http;
                        if (http > url) {
                        while (' ' == *url) ++url;
                        while (' ' == *(http-1)) --http;
                        if (http > url) {
-                               PHP_HTTP_INFO(info).request.url = php_http_url_parse(url, http - url, ~0 TSRMLS_CC);
+                               PHP_HTTP_INFO(info).request.url = php_http_url_parse(url, http - url, ~0);
                        } else {
                                PTR_SET(PHP_HTTP_INFO(info).request.method, NULL);
                                return NULL;
                        } else {
                                PTR_SET(PHP_HTTP_INFO(info).request.method, NULL);
                                return NULL;
index d31b505d8d3e378b99628acbf4b906e2cb179121..579f5733b91967be9db0c27b95904472cad3b88a 100644 (file)
@@ -54,10 +54,10 @@ typedef struct php_http_info {
        PHP_HTTP_INFO_IMPL(http, type)
 } php_http_info_t;
 
        PHP_HTTP_INFO_IMPL(http, type)
 } php_http_info_t;
 
-typedef zend_bool (*php_http_info_callback_t)(void **callback_data, HashTable **headers, php_http_info_t *info TSRMLS_DC);
+typedef zend_bool (*php_http_info_callback_t)(void **callback_data, HashTable **headers, php_http_info_t *info);
 
 
-PHP_HTTP_API php_http_info_t *php_http_info_init(php_http_info_t *info TSRMLS_DC);
-PHP_HTTP_API php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_header TSRMLS_DC);
+PHP_HTTP_API php_http_info_t *php_http_info_init(php_http_info_t *info);
+PHP_HTTP_API php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_header);
 PHP_HTTP_API void php_http_info_dtor(php_http_info_t *info);
 PHP_HTTP_API void php_http_info_free(php_http_info_t **info);
 
 PHP_HTTP_API void php_http_info_dtor(php_http_info_t *info);
 PHP_HTTP_API void php_http_info_free(php_http_info_t **info);
 
index 8a7e564a761990743270c2e7c736de49cc2471ce..b32a8226f19f889425e5fd3f4438fad3da5a7fac 100644 (file)
@@ -14,7 +14,7 @@
 
 static void message_headers(php_http_message_t *msg, php_http_buffer_t *str);
 
 
 static void message_headers(php_http_message_t *msg, php_http_buffer_t *str);
 
-zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC)
+zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info)
 {
        php_http_message_t *old = *message;
 
 {
        php_http_message_t *old = *message;
 
@@ -34,24 +34,23 @@ zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable
        return old != *message;
 }
 
        return old != *message;
 }
 
-php_http_message_t *php_http_message_init(php_http_message_t *message, php_http_message_type_t type, php_http_message_body_t *body TSRMLS_DC)
+php_http_message_t *php_http_message_init(php_http_message_t *message, php_http_message_type_t type, php_http_message_body_t *body)
 {
        if (!message) {
                message = emalloc(sizeof(*message));
        }
        memset(message, 0, sizeof(*message));
 {
        if (!message) {
                message = emalloc(sizeof(*message));
        }
        memset(message, 0, sizeof(*message));
-       TSRMLS_SET_CTX(message->ts);
 
        php_http_message_set_type(message, type);
        message->http.version.major = 1;
        message->http.version.minor = 1;
        zend_hash_init(&message->hdrs, 0, NULL, ZVAL_PTR_DTOR, 0);
 
        php_http_message_set_type(message, type);
        message->http.version.major = 1;
        message->http.version.minor = 1;
        zend_hash_init(&message->hdrs, 0, NULL, ZVAL_PTR_DTOR, 0);
-       message->body = body ? body : php_http_message_body_init(NULL, NULL TSRMLS_CC);
+       message->body = body ? body : php_http_message_body_init(NULL, NULL);
 
        return message;
 }
 
 
        return message;
 }
 
-php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_http_message_type_t type TSRMLS_DC)
+php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_http_message_type_t type)
 {
        int free_msg = !message;
        zval *sval, tval;
 {
        int free_msg = !message;
        zval *sval, tval;
@@ -59,59 +58,44 @@ php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_h
        
        switch (type) {
                case PHP_HTTP_REQUEST:
        
        switch (type) {
                case PHP_HTTP_REQUEST:
-                       mbody = php_http_env_get_request_body(TSRMLS_C);
+                       mbody = php_http_env_get_request_body();
                        php_http_message_body_addref(mbody);
                        php_http_message_body_addref(mbody);
-                       message = php_http_message_init(message, type, mbody TSRMLS_CC);
-                       if ((sval = php_http_env_get_server_var(ZEND_STRL("SERVER_PROTOCOL"), 1 TSRMLS_CC)) && !strncmp(Z_STRVAL_P(sval), "HTTP/", lenof("HTTP/"))) {
-                               php_http_version_parse(&message->http.version, Z_STRVAL_P(sval) TSRMLS_CC);
+                       message = php_http_message_init(message, type, mbody);
+                       if ((sval = php_http_env_get_server_var(ZEND_STRL("SERVER_PROTOCOL"), 1)) && !strncmp(Z_STRVAL_P(sval), "HTTP/", lenof("HTTP/"))) {
+                               php_http_version_parse(&message->http.version, Z_STRVAL_P(sval));
                        }
                        }
-                       if ((sval = php_http_env_get_server_var(ZEND_STRL("REQUEST_METHOD"), 1 TSRMLS_CC))) {
+                       if ((sval = php_http_env_get_server_var(ZEND_STRL("REQUEST_METHOD"), 1))) {
                                message->http.info.request.method = estrdup(Z_STRVAL_P(sval));
                        }
                                message->http.info.request.method = estrdup(Z_STRVAL_P(sval));
                        }
-                       if ((sval = php_http_env_get_server_var(ZEND_STRL("REQUEST_URI"), 1 TSRMLS_CC))) {
-                               message->http.info.request.url = php_http_url_parse(Z_STRVAL_P(sval), Z_STRLEN_P(sval), ~0 TSRMLS_CC);
+                       if ((sval = php_http_env_get_server_var(ZEND_STRL("REQUEST_URI"), 1))) {
+                               message->http.info.request.url = php_http_url_parse(Z_STRVAL_P(sval), Z_STRLEN_P(sval), ~0);
                        }
                        
                        }
                        
-                       php_http_env_get_request_headers(&message->hdrs TSRMLS_CC);
+                       php_http_env_get_request_headers(&message->hdrs);
                        break;
                        
                case PHP_HTTP_RESPONSE:
                        break;
                        
                case PHP_HTTP_RESPONSE:
-                       message = php_http_message_init(NULL, type, NULL TSRMLS_CC);
-                       if (!SG(sapi_headers).http_status_line || !php_http_info_parse((php_http_info_t *) &message->http, SG(sapi_headers).http_status_line TSRMLS_CC)) {
+                       message = php_http_message_init(NULL, type, NULL);
+                       if (!SG(sapi_headers).http_status_line || !php_http_info_parse((php_http_info_t *) &message->http, SG(sapi_headers).http_status_line)) {
                                if (!(message->http.info.response.code = SG(sapi_headers).http_response_code)) {
                                        message->http.info.response.code = 200;
                                }
                                message->http.info.response.status = estrdup(php_http_env_get_response_status_for_code(message->http.info.response.code));
                        }
                        
                                if (!(message->http.info.response.code = SG(sapi_headers).http_response_code)) {
                                        message->http.info.response.code = 200;
                                }
                                message->http.info.response.status = estrdup(php_http_env_get_response_status_for_code(message->http.info.response.code));
                        }
                        
-                       php_http_env_get_response_headers(&message->hdrs TSRMLS_CC);
-#if PHP_VERSION_ID >= 50400
-                       if (php_output_get_level(TSRMLS_C)) {
-                               if (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_SENT) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(TSRMLS_C), php_output_get_start_lineno(TSRMLS_C));
+                       php_http_env_get_response_headers(&message->hdrs);
+                       if (php_output_get_level()) {
+                               if (php_output_get_status() & PHP_OUTPUT_SENT) {
+                                       php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(TSRMLS_C), php_output_get_start_lineno(TSRMLS_C));
                                        goto error;
                                        goto error;
-                               } else if (SUCCESS != php_output_get_contents(&tval TSRMLS_CC)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch response body");
+                               } else if (SUCCESS != php_output_get_contents(&tval)) {
+                                       php_error_docref(NULL, E_WARNING, "Could not fetch response body");
                                        goto error;
                                } else {
                                        php_http_message_body_append(message->body, Z_STRVAL(tval), Z_STRLEN(tval));
                                        zval_dtor(&tval);
                                }
                        }
                                        goto error;
                                } else {
                                        php_http_message_body_append(message->body, Z_STRVAL(tval), Z_STRLEN(tval));
                                        zval_dtor(&tval);
                                }
                        }
-#else
-                       if (OG(ob_nesting_level)) {
-                               if (php_get_output_start_filename(TSRMLS_C)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_get_output_start_filename(TSRMLS_C), php_get_output_start_lineno(TSRMLS_C));
-                                       goto error;
-                               } else if (SUCCESS != php_ob_get_buffer(&tval TSRMLS_CC)) {
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch response body");
-                                       goto error;
-                               } else {
-                                       php_http_message_body_append(message->body, Z_STRVAL(tval), Z_STRLEN(tval));
-                                       zval_dtor(&tval);
-                               }
-                       }
-#endif
                        break;
                        
                default:
                        break;
                        
                default:
@@ -129,7 +113,7 @@ php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_h
        return message;
 }
 
        return message;
 }
 
-php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len, zend_bool greedy TSRMLS_DC)
+php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len, zend_bool greedy)
 {
        php_http_message_parser_t p;
        php_http_buffer_t buf;
 {
        php_http_message_parser_t p;
        php_http_buffer_t buf;
@@ -137,10 +121,10 @@ php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *
        int free_msg;
 
        php_http_buffer_from_string_ex(&buf, str, len);
        int free_msg;
 
        php_http_buffer_from_string_ex(&buf, str, len);
-       php_http_message_parser_init(&p TSRMLS_CC);
+       php_http_message_parser_init(&p);
 
        if ((free_msg = !msg)) {
 
        if ((free_msg = !msg)) {
-               msg = php_http_message_init(NULL, 0, NULL TSRMLS_CC);
+               msg = php_http_message_init(NULL, 0, NULL);
        }
 
        if (greedy) {
        }
 
        if (greedy) {
@@ -159,27 +143,19 @@ php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *
        return msg;
 }
 
        return msg;
 }
 
-zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len, int join)
+zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len)
 {
 {
-       zval *ret = NULL, **header;
+       zval *ret;
        char *key;
        ALLOCA_FLAG(free_key);
 
        key = do_alloca(key_len + 1, free_key);
        char *key;
        ALLOCA_FLAG(free_key);
 
        key = do_alloca(key_len + 1, free_key);
+
        memcpy(key, key_str, key_len);
        key[key_len] = '\0';
        php_http_pretty_key(key, key_len, 1, 1);
 
        memcpy(key, key_str, key_len);
        key[key_len] = '\0';
        php_http_pretty_key(key, key_len, 1, 1);
 
-       if (SUCCESS == zend_symtable_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
-               if (join && Z_TYPE_PP(header) == IS_ARRAY) {
-                       TSRMLS_FETCH_FROM_CTX(msg->ts);
-
-                       ret = php_http_header_value_to_string(*header TSRMLS_CC);
-               } else {
-                       Z_ADDREF_PP(header);
-                       ret = *header;
-               }
-       }
+       ret = zend_symtable_str_find(&msg->hdrs, key, key_len);
 
        free_alloca(key, free_key);
 
 
        free_alloca(key, free_key);
 
@@ -188,9 +164,8 @@ zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size
 
 zend_bool php_http_message_is_multipart(php_http_message_t *msg, char **boundary)
 {
 
 zend_bool php_http_message_is_multipart(php_http_message_t *msg, char **boundary)
 {
-       zval *ct = php_http_message_header(msg, ZEND_STRL("Content-Type"), 1);
+       zend_string *ct = php_http_message_header_string(msg, ZEND_STRL("Content-Type"));
        zend_bool is_multipart = 0;
        zend_bool is_multipart = 0;
-       TSRMLS_FETCH_FROM_CTX(msg->ts);
 
        if (ct) {
                php_http_params_opts_t popts;
 
        if (ct) {
                php_http_params_opts_t popts;
@@ -198,47 +173,49 @@ zend_bool php_http_message_is_multipart(php_http_message_t *msg, char **boundary
 
                ZEND_INIT_SYMTABLE(&params);
                php_http_params_opts_default_get(&popts);
 
                ZEND_INIT_SYMTABLE(&params);
                php_http_params_opts_default_get(&popts);
-               popts.input.str = Z_STRVAL_P(ct);
-               popts.input.len = Z_STRLEN_P(ct);
+               popts.input.str = ct->val;
+               popts.input.len = ct->len;
 
 
-               if (php_http_params_parse(&params, &popts TSRMLS_CC)) {
-                       zval **cur, **arg;
-                       char *ct_str;
+               if (php_http_params_parse(&params, &popts)) {
+                       zval *cur, *arg;
+                       zend_string *ct_str;
+                       zend_ulong index;
 
                        zend_hash_internal_pointer_reset(&params);
 
 
                        zend_hash_internal_pointer_reset(&params);
 
-                       if (SUCCESS == zend_hash_get_current_data(&params, (void *) &cur)
-                       &&      Z_TYPE_PP(cur) == IS_ARRAY
-                       &&      HASH_KEY_IS_STRING == zend_hash_get_current_key(&params, &ct_str, NULL, 0)
+                       if ((cur = zend_hash_get_current_data(&params))
+                       &&      (Z_TYPE_P(cur) == IS_ARRAY)
+                       &&      (HASH_KEY_IS_STRING == zend_hash_get_current_key(&params, &ct_str, &index))
                        ) {
                        ) {
-                               if (php_http_match(ct_str, "multipart", PHP_HTTP_MATCH_WORD)) {
+                               if (php_http_match(ct_str->val, "multipart", PHP_HTTP_MATCH_WORD)) {
                                        is_multipart = 1;
 
                                        /* get boundary */
                                        if (boundary
                                        is_multipart = 1;
 
                                        /* get boundary */
                                        if (boundary
-                                       &&      SUCCESS == zend_hash_find(Z_ARRVAL_PP(cur), ZEND_STRS("arguments"), (void *) &arg)
-                                       &&      Z_TYPE_PP(arg) == IS_ARRAY
+                                       &&      (arg = zend_hash_str_find(Z_ARRVAL_P(cur), ZEND_STRL("arguments")))
+                                       &&      Z_TYPE_P(arg) == IS_ARRAY
                                        ) {
                                        ) {
-                                               zval **val;
-                                               HashPosition pos;
-                                               php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+                                               zval *val;
+                                               php_http_arrkey_t key;
 
 
-                                               FOREACH_KEYVAL(pos, *arg, key, val) {
-                                                       if (key.type == HASH_KEY_IS_STRING && !strcasecmp(key.str, "boundary")) {
-                                                               zval *bnd = php_http_ztyp(IS_STRING, *val);
+                                               ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(arg), key.h, key.key, val)
+                                               {
+                                                       if (key.key && key.key->len == lenof("boundary") && !strcasecmp(key.key->val, "boundary")) {
+                                                               zend_string *bnd = zval_get_string(val);
 
 
-                                                               if (Z_STRLEN_P(bnd)) {
-                                                                       *boundary = estrndup(Z_STRVAL_P(bnd), Z_STRLEN_P(bnd));
+                                                               if (bnd->len) {
+                                                                       *boundary = estrndup(bnd->val, bnd->len);
                                                                }
                                                                }
-                                                               zval_ptr_dtor(&bnd);
+                                                               zend_string_release(bnd);
                                                        }
                                                }
                                                        }
                                                }
+                                               ZEND_HASH_FOREACH_END();
                                        }
                                }
                        }
                }
                zend_hash_destroy(&params);
                                        }
                                }
                        }
                }
                zend_hash_destroy(&params);
-               zval_ptr_dtor(&ct);
+               zend_string_release(ct);
        }
 
        return is_multipart;
        }
 
        return is_multipart;
@@ -292,48 +269,45 @@ void php_http_message_set_info(php_http_message_t *message, php_http_info_t *inf
 
 void php_http_message_update_headers(php_http_message_t *msg)
 {
 
 void php_http_message_update_headers(php_http_message_t *msg)
 {
-       zval *h;
+       zval h;
        size_t size;
        size_t size;
+       zend_string *cl;
 
        if (php_http_message_body_stream(msg->body)->readfilters.head) {
                /* if a read stream filter is attached to the body the caller must also care for the headers */
        } else if ((size = php_http_message_body_size(msg->body))) {
 
        if (php_http_message_body_stream(msg->body)->readfilters.head) {
                /* if a read stream filter is attached to the body the caller must also care for the headers */
        } else if ((size = php_http_message_body_size(msg->body))) {
-               MAKE_STD_ZVAL(h);
-               ZVAL_LONG(h, size);
-               zend_hash_update(&msg->hdrs, "Content-Length", sizeof("Content-Length"), &h, sizeof(zval *), NULL);
+               ZVAL_LONG(&h, size);
+               zend_hash_str_update(&msg->hdrs, "Content-Length", lenof("Content-Length"), &h);
 
                if (msg->body->boundary) {
                        char *str;
                        size_t len;
 
                if (msg->body->boundary) {
                        char *str;
                        size_t len;
+                       zend_string *ct;
 
 
-                       if (!(h = php_http_message_header(msg, ZEND_STRL("Content-Type"), 1))) {
+                       if (!(ct = php_http_message_header_string(msg, ZEND_STRL("Content-Type")))) {
                                len = spprintf(&str, 0, "multipart/form-data; boundary=\"%s\"", msg->body->boundary);
                                len = spprintf(&str, 0, "multipart/form-data; boundary=\"%s\"", msg->body->boundary);
-                               MAKE_STD_ZVAL(h);
-                               ZVAL_STRINGL(h, str, len, 0);
-                               zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
-                       } else if (!php_http_match(Z_STRVAL_P(h), "boundary=", PHP_HTTP_MATCH_WORD)) {
-                               zval_dtor(h);
-                               Z_STRLEN_P(h) = spprintf(&Z_STRVAL_P(h), 0, "%s; boundary=\"%s\"", Z_STRVAL_P(h), msg->body->boundary);
-                               zend_hash_update(&msg->hdrs, "Content-Type", sizeof("Content-Type"), &h, sizeof(zval *), NULL);
+                               ZVAL_STR(&h, php_http_cs2zs(str, len));
+                               zend_hash_str_update(&msg->hdrs, "Content-Type", lenof("Content-Type"), &h);
+                       } else if (!php_http_match(ct->val, "boundary=", PHP_HTTP_MATCH_WORD)) {
+                               len = spprintf(&str, 0, "%s; boundary=\"%s\"", ct->val, msg->body->boundary);
+                               ZVAL_STR(&h, php_http_cs2zs(str, len));
+                               zend_hash_str_update(&msg->hdrs, "Content-Type", lenof("Content-Type"), &h);
+                               zend_string_release(ct);
                        } else {
                        } else {
-                               zval_ptr_dtor(&h);
+                               zend_string_release(ct);
                        }
                }
                        }
                }
-       } else if ((h = php_http_message_header(msg, ZEND_STRL("Content-Length"), 1))) {
-               zval *h_cpy = php_http_ztyp(IS_LONG, h);
-
-               zval_ptr_dtor(&h);
-               if (Z_LVAL_P(h_cpy)) {
-                       zend_hash_del(&msg->hdrs, "Content-Length", sizeof("Content-Length"));
+       } else if ((cl = php_http_message_header_string(msg, ZEND_STRL("Content-Length")))) {
+               if (!zend_string_equals_literal(cl, "0")) {
+                       zend_hash_str_del(&msg->hdrs, ZEND_STRL("Content-Length"));
                }
                }
-               zval_ptr_dtor(&h_cpy);
+               zend_string_release(cl);
        }
 }
 
 static void message_headers(php_http_message_t *msg, php_http_buffer_t *str)
 {
        char *tmp = NULL;
        }
 }
 
 static void message_headers(php_http_message_t *msg, php_http_buffer_t *str)
 {
        char *tmp = NULL;
-       TSRMLS_FETCH_FROM_CTX(msg->ts);
 
        switch (msg->type) {
                case PHP_HTTP_REQUEST:
 
        switch (msg->type) {
                case PHP_HTTP_REQUEST:
@@ -351,7 +325,7 @@ static void message_headers(php_http_message_t *msg, php_http_buffer_t *str)
        }
 
        php_http_message_update_headers(msg);
        }
 
        php_http_message_update_headers(msg);
-       php_http_header_to_string(str, &msg->hdrs TSRMLS_CC);
+       php_http_header_to_string(str, &msg->hdrs);
 }
 
 void php_http_message_to_callback(php_http_message_t *msg, php_http_pass_callback_t cb, void *cb_arg)
 }
 
 void php_http_message_to_callback(php_http_message_t *msg, php_http_pass_callback_t cb, void *cb_arg)
@@ -414,9 +388,7 @@ void php_http_message_serialize(php_http_message_t *message, char **string, size
 
 php_http_message_t *php_http_message_reverse(php_http_message_t *msg)
 {
 
 php_http_message_t *php_http_message_reverse(php_http_message_t *msg)
 {
-       int i, c = 0;
-       
-       php_http_message_count(c, msg);
+       size_t i, c = php_http_message_count(msg);
        
        if (c > 1) {
                php_http_message_t *tmp = msg, **arr;
        
        if (c > 1) {
                php_http_message_t *tmp = msg, **arr;
@@ -438,11 +410,11 @@ php_http_message_t *php_http_message_reverse(php_http_message_t *msg)
        return msg;
 }
 
        return msg;
 }
 
-php_http_message_t *php_http_message_zip(php_http_message_t *one, php_http_message_t *two)
+php_http_message_t *php_http_message_zip(php_http_message_t *dst, php_http_message_t *src)
 {
 {
-       php_http_message_t *dst = php_http_message_copy(one, NULL), *src = php_http_message_copy(two, NULL), *tmp_dst, *tmp_src, *ret = dst;
+       php_http_message_t *tmp_dst, *tmp_src, *ret = dst;
 
 
-       while(dst && src) {
+       while (dst && src) {
                tmp_dst = dst->parent;
                tmp_src = src->parent;
                dst->parent = src;
                tmp_dst = dst->parent;
                tmp_src = src->parent;
                dst->parent = src;
@@ -460,23 +432,22 @@ php_http_message_t *php_http_message_copy_ex(php_http_message_t *from, php_http_
 {
        php_http_message_t *temp, *copy = NULL;
        php_http_info_t info;
 {
        php_http_message_t *temp, *copy = NULL;
        php_http_info_t info;
-       TSRMLS_FETCH_FROM_CTX(from->ts);
        
        if (from) {
                info.type = from->type;
                info.http = from->http;
                
        
        if (from) {
                info.type = from->type;
                info.http = from->http;
                
-               copy = temp = php_http_message_init(to, 0, php_http_message_body_copy(from->body, NULL) TSRMLS_CC);
+               copy = temp = php_http_message_init(to, 0, php_http_message_body_copy(from->body, NULL));
                php_http_message_set_info(temp, &info);
                php_http_message_set_info(temp, &info);
-               zend_hash_copy(&temp->hdrs, &from->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+               zend_hash_copy(&temp->hdrs, &from->hdrs, (copy_ctor_func_t) zval_add_ref);
        
                if (parents) while (from->parent) {
                        info.type = from->parent->type;
                        info.http = from->parent->http;
                
        
                if (parents) while (from->parent) {
                        info.type = from->parent->type;
                        info.http = from->parent->http;
                
-                       temp->parent = php_http_message_init(NULL, 0, php_http_message_body_copy(from->parent->body, NULL) TSRMLS_CC);
+                       temp->parent = php_http_message_init(NULL, 0, php_http_message_body_copy(from->parent->body, NULL));
                        php_http_message_set_info(temp->parent, &info);
                        php_http_message_set_info(temp->parent, &info);
-                       zend_hash_copy(&temp->parent->hdrs, &from->parent->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+                       array_copy(&from->parent->hdrs, &temp->parent->hdrs);
                
                        temp = temp->parent;
                        from = from->parent;
                
                        temp = temp->parent;
                        from = from->parent;
@@ -486,11 +457,6 @@ php_http_message_t *php_http_message_copy_ex(php_http_message_t *from, php_http_
        return copy;
 }
 
        return copy;
 }
 
-php_http_message_t *php_http_message_copy(php_http_message_t *from, php_http_message_t *to)
-{
-       return php_http_message_copy_ex(from, to, 1);
-}
-
 void php_http_message_dtor(php_http_message_t *message)
 {
        if (message) {
 void php_http_message_dtor(php_http_message_t *message)
 {
        if (message) {
@@ -525,141 +491,150 @@ void php_http_message_free(php_http_message_t **message)
        }
 }
 
        }
 }
 
-static zval *php_http_message_object_read_prop(zval *object, zval *member, int type PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC);
-static void php_http_message_object_write_prop(zval *object, zval *member, zval *value PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC);
-static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC);
+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;
 
-typedef void (*php_http_message_object_prophandler_func_t)(php_http_message_object_t *o, zval *v TSRMLS_DC);
+typedef void (*php_http_message_object_prophandler_func_t)(php_http_message_object_t *o, zval *v);
 
 typedef struct php_http_message_object_prophandler {
        php_http_message_object_prophandler_func_t read;
        php_http_message_object_prophandler_func_t write;
 } php_http_message_object_prophandler_t;
 
 
 typedef struct php_http_message_object_prophandler {
        php_http_message_object_prophandler_func_t read;
        php_http_message_object_prophandler_func_t write;
 } php_http_message_object_prophandler_t;
 
-static STATUS php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) {
+static ZEND_RESULT_CODE php_http_message_object_add_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_func_t read, php_http_message_object_prophandler_func_t write) {
        php_http_message_object_prophandler_t h = { read, write };
        php_http_message_object_prophandler_t h = { read, write };
-       return zend_hash_add(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) &h, sizeof(h), NULL);
+       if (!zend_hash_str_add_mem(&php_http_message_object_prophandlers, prop_str, prop_len, (void *) &h, sizeof(h))) {
+               return FAILURE;
+       }
+       return SUCCESS;
 }
 }
-static STATUS php_http_message_object_get_prophandler(const char *prop_str, size_t prop_len, php_http_message_object_prophandler_t **handler) {
-       return zend_hash_find(&php_http_message_object_prophandlers, prop_str, prop_len + 1, (void *) handler);
+static php_http_message_object_prophandler_t *php_http_message_object_get_prophandler(zend_string *name_str) {
+       return zend_hash_str_find_ptr(&php_http_message_object_prophandlers, name_str->val, name_str->len);
 }
 }
-static void php_http_message_object_prophandler_get_type(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_type(php_http_message_object_t *obj, zval *return_value) {
        RETVAL_LONG(obj->message->type);
 }
        RETVAL_LONG(obj->message->type);
 }
-static void php_http_message_object_prophandler_set_type(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
-       zval *cpy = php_http_ztyp(IS_LONG, value);
-       php_http_message_set_type(obj->message, Z_LVAL_P(cpy));
-       zval_ptr_dtor(&cpy);
+static void php_http_message_object_prophandler_set_type(php_http_message_object_t *obj, zval *value) {
+       php_http_message_set_type(obj->message, zval_get_long(value));
 }
 }
-static void php_http_message_object_prophandler_get_request_method(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_request_method(php_http_message_object_t *obj, zval *return_value) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message) && obj->message->http.info.request.method) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message) && obj->message->http.info.request.method) {
-               RETVAL_STRING(obj->message->http.info.request.method, 1);
+               RETVAL_STRING(obj->message->http.info.request.method);
        } else {
                RETVAL_NULL();
        }
 }
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_request_method(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
+static void php_http_message_object_prophandler_set_request_method(php_http_message_object_t *obj, zval *value) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
-               zval *cpy = php_http_ztyp(IS_STRING, value);
-               PTR_SET(obj->message->http.info.request.method, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
-               zval_ptr_dtor(&cpy);
+               zend_string *zs = zval_get_string(value);
+               PTR_SET(obj->message->http.info.request.method, estrndup(zs->val, zs->len));
+               zend_string_release(zs);
        }
 }
        }
 }
-static void php_http_message_object_prophandler_get_request_url(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_request_url(php_http_message_object_t *obj, zval *return_value) {
        char *url_str;
        size_t url_len;
 
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message) && obj->message->http.info.request.url && php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0)) {
        char *url_str;
        size_t url_len;
 
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message) && obj->message->http.info.request.url && php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0)) {
-               RETVAL_STRINGL(url_str, url_len, 0);
+               RETVAL_STR(php_http_cs2zs(url_str, url_len));
        } else {
                RETVAL_NULL();
        }
 }
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_request_url(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
+static void php_http_message_object_prophandler_set_request_url(php_http_message_object_t *obj, zval *value) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
        if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
-               PTR_SET(obj->message->http.info.request.url, php_http_url_from_zval(value, ~0 TSRMLS_CC));
+               PTR_SET(obj->message->http.info.request.url, php_http_url_from_zval(value, ~0));
        }
 }
        }
 }
-static void php_http_message_object_prophandler_get_response_status(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_response_status(php_http_message_object_t *obj, zval *return_value) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message) && obj->message->http.info.response.status) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message) && obj->message->http.info.response.status) {
-               RETVAL_STRING(obj->message->http.info.response.status, 1);
+               RETVAL_STRING(obj->message->http.info.response.status);
        } else {
                RETVAL_NULL();
        }
 }
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_response_status(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
+static void php_http_message_object_prophandler_set_response_status(php_http_message_object_t *obj, zval *value) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
-               zval *cpy = php_http_ztyp(IS_STRING, value);
-               PTR_SET(obj->message->http.info.response.status, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
-               zval_ptr_dtor(&cpy);
+               zend_string *zs = zval_get_string(value);
+               PTR_SET(obj->message->http.info.response.status, estrndup(zs->val, zs->len));
+               zend_string_release(zs);
        }
 }
        }
 }
-static void php_http_message_object_prophandler_get_response_code(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_response_code(php_http_message_object_t *obj, zval *return_value) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
                RETVAL_LONG(obj->message->http.info.response.code);
        } else {
                RETVAL_NULL();
        }
 }
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
                RETVAL_LONG(obj->message->http.info.response.code);
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_response_code(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
+static void php_http_message_object_prophandler_set_response_code(php_http_message_object_t *obj, zval *value) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
        if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
-               zval *cpy = php_http_ztyp(IS_LONG, value);
-               obj->message->http.info.response.code = Z_LVAL_P(cpy);
+               obj->message->http.info.response.code = zval_get_long(value);
                PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(obj->message->http.info.response.code)));
                PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(obj->message->http.info.response.code)));
-               zval_ptr_dtor(&cpy);
        }
 }
        }
 }
-static void php_http_message_object_prophandler_get_http_version(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_http_version(php_http_message_object_t *obj, zval *return_value) {
        char *version_str;
        size_t version_len;
 
        char *version_str;
        size_t version_len;
 
-       php_http_version_to_string(&obj->message->http.version, &version_str, &version_len, NULL, NULL TSRMLS_CC);
-       RETVAL_STRINGL(version_str, version_len, 0);
+       php_http_version_to_string(&obj->message->http.version, &version_str, &version_len, NULL, NULL);
+       RETVAL_STR(php_http_cs2zs(version_str, version_len));
 }
 }
-static void php_http_message_object_prophandler_set_http_version(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
-       zval *cpy = php_http_ztyp(IS_STRING, value);
-       php_http_version_parse(&obj->message->http.version, Z_STRVAL_P(cpy) TSRMLS_CC);
-       zval_ptr_dtor(&cpy);
+static void php_http_message_object_prophandler_set_http_version(php_http_message_object_t *obj, zval *value) {
+       zend_string *zs = zval_get_string(value);
+       php_http_version_parse(&obj->message->http.version, zs->val);
+       zend_string_release(zs);
 }
 }
-static void php_http_message_object_prophandler_get_headers(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_headers(php_http_message_object_t *obj, zval *return_value ) {
        array_init(return_value);
        array_init(return_value);
-       zend_hash_copy(Z_ARRVAL_P(return_value), &obj->message->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+       array_copy(&obj->message->hdrs, Z_ARRVAL_P(return_value));
 }
 }
-static void php_http_message_object_prophandler_set_headers(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
-       zval *cpy = php_http_ztyp(IS_ARRAY, value);
+static void php_http_message_object_prophandler_set_headers(php_http_message_object_t *obj, zval *value) {
+       HashTable *headers;
+       zval *orig_value = value;
+
+       if (Z_TYPE_P(value) != IS_ARRAY && Z_TYPE_P(value) != IS_OBJECT) {
+               convert_to_array_ex(value);
+       } else {
+               headers = HASH_OF(value);
+       }
 
        zend_hash_clean(&obj->message->hdrs);
 
        zend_hash_clean(&obj->message->hdrs);
-       zend_hash_copy(&obj->message->hdrs, Z_ARRVAL_P(cpy), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-       zval_ptr_dtor(&cpy);
+       array_copy(headers, &obj->message->hdrs);
+
+       if (orig_value != value) {
+               zval_ptr_dtor(value);
+       }
 }
 }
-static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value) {
        if (obj->body) {
        if (obj->body) {
-               RETVAL_OBJVAL(obj->body->zv, 1);
+               RETVAL_OBJECT(&obj->body->zo, 1);
        } else {
                RETVAL_NULL();
        }
 }
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_body(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
-       php_http_message_object_set_body(obj, value TSRMLS_CC);
+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 void php_http_message_object_prophandler_get_parent_message(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
+static void php_http_message_object_prophandler_get_parent_message(php_http_message_object_t *obj, zval *return_value) {
        if (obj->message->parent) {
        if (obj->message->parent) {
-               RETVAL_OBJVAL(obj->parent->zv, 1);
+               RETVAL_OBJECT(&obj->parent->zo, 1);
        } else {
                RETVAL_NULL();
        }
 }
        } else {
                RETVAL_NULL();
        }
 }
-static void php_http_message_object_prophandler_set_parent_message(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
-       if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_message_class_entry TSRMLS_CC)) {
-               php_http_message_object_t *parent_obj = zend_object_store_get_object(value TSRMLS_CC);
+static void php_http_message_object_prophandler_set_parent_message(php_http_message_object_t *obj, zval *value) {
+       if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_message_class_entry)) {
+               php_http_message_object_t *parent_obj = PHP_HTTP_OBJ(NULL, value);
 
                if (obj->message->parent) {
 
                if (obj->message->parent) {
-                       zend_objects_store_del_ref_by_handle(obj->parent->zv.handle TSRMLS_CC);
+                       zend_objects_store_del(&obj->parent->zo);
                }
                }
-               Z_OBJ_ADDREF_P(value);
+               Z_ADDREF_P(value);
                obj->parent = parent_obj;
                obj->message->parent = parent_obj->message;
        }
                obj->parent = parent_obj;
                obj->message->parent = parent_obj->message;
        }
@@ -668,20 +643,20 @@ static void php_http_message_object_prophandler_set_parent_message(php_http_mess
 #define PHP_HTTP_MESSAGE_OBJECT_INIT(obj) \
        do { \
                if (!obj->message) { \
 #define PHP_HTTP_MESSAGE_OBJECT_INIT(obj) \
        do { \
                if (!obj->message) { \
-                       obj->message = php_http_message_init(NULL, 0, NULL TSRMLS_CC); \
+                       obj->message = php_http_message_init(NULL, 0, NULL); \
                } \
        } while(0)
 
 
                } \
        } while(0)
 
 
-void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC)
+void php_http_message_object_reverse(zval *zmsg, zval *return_value)
 {
 {
-       int i = 0;
-       php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       size_t i;
+       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, zmsg);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        /* count */
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        /* count */
-       php_http_message_count(i, obj->message);
+       i = php_http_message_count(obj->message);
 
        if (i > 1) {
                php_http_message_object_t **objects;
 
        if (i > 1) {
                php_http_message_object_t **objects;
@@ -707,24 +682,20 @@ void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_D
                objects[0]->parent = NULL;
 
                /* add ref, because we previously have not been a parent message */
                objects[0]->parent = NULL;
 
                /* add ref, because we previously have not been a parent message */
-               Z_OBJ_ADDREF_P(getThis());
-               RETVAL_OBJVAL(objects[last]->zv, 0);
+               Z_ADDREF_P(zmsg);
+               RETVAL_OBJ(&objects[last]->zo);
 
                efree(objects);
        } else {
 
                efree(objects);
        } else {
-               RETURN_ZVAL(getThis(), 1, 0);
+               RETURN_ZVAL_FAST(zmsg);
        }
 }
 
        }
 }
 
-void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top TSRMLS_DC)
+void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top)
 {
 {
-       zval m;
        php_http_message_t *save_parent_msg = NULL;
        php_http_message_t *save_parent_msg = NULL;
-       php_http_message_object_t *save_parent_obj = NULL, *obj = zend_object_store_get_object(this_ptr TSRMLS_CC);
-       php_http_message_object_t *prepend_obj = zend_object_store_get_object(prepend TSRMLS_CC);
-
-       INIT_PZVAL(&m);
-       m.type = IS_OBJECT;
+       php_http_message_object_t *save_parent_obj = NULL, *obj = PHP_HTTP_OBJ(NULL, this_ptr);
+       php_http_message_object_t *prepend_obj = PHP_HTTP_OBJ(NULL, prepend);
 
        if (!top) {
                save_parent_obj = obj->parent;
 
        if (!top) {
                save_parent_obj = obj->parent;
@@ -741,7 +712,7 @@ void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool to
        obj->message->parent = prepend_obj->message;
 
        /* add ref */
        obj->message->parent = prepend_obj->message;
 
        /* add ref */
-       zend_objects_store_add_ref(prepend TSRMLS_CC);
+       Z_ADDREF_P(prepend);
 
        if (!top) {
                prepend_obj->parent = save_parent_obj;
 
        if (!top) {
                prepend_obj->parent = save_parent_obj;
@@ -749,17 +720,16 @@ void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool to
        }
 }
 
        }
 }
 
-STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody TSRMLS_DC)
+ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval *zbody)
 {
 {
-       zval *tmp = NULL;
        php_stream *s;
        php_stream *s;
-       zend_object_value ov;
+       zend_string *body_str;
        php_http_message_body_t *body;
        php_http_message_body_object_t *body_obj;
 
        switch (Z_TYPE_P(zbody)) {
                case IS_RESOURCE:
        php_http_message_body_t *body;
        php_http_message_body_object_t *body_obj;
 
        switch (Z_TYPE_P(zbody)) {
                case IS_RESOURCE:
-                       php_stream_from_zval_no_verify(s, &zbody);
+                       php_stream_from_zval_no_verify(s, zbody);
                        if (!s) {
                                php_http_throw(unexpected_val, "The stream is not a valid resource", NULL);
                                return FAILURE;
                        if (!s) {
                                php_http_throw(unexpected_val, "The stream is not a valid resource", NULL);
                                return FAILURE;
@@ -767,112 +737,97 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval
 
                        is_resource:
 
 
                        is_resource:
 
-                       body = php_http_message_body_init(NULL, s TSRMLS_CC);
-                       if (SUCCESS != php_http_new(&ov, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, body, NULL TSRMLS_CC)) {
+                       body = php_http_message_body_init(NULL, s);
+                       if (!(body_obj = php_http_message_body_object_new_ex(php_http_message_body_class_entry, body))) {
                                php_http_message_body_free(&body);
                                return FAILURE;
                        }
                                php_http_message_body_free(&body);
                                return FAILURE;
                        }
-                       MAKE_STD_ZVAL(tmp);
-                       ZVAL_OBJVAL(tmp, ov, 0);
-                       zbody = tmp;
                        break;
 
                case IS_OBJECT:
                        break;
 
                case IS_OBJECT:
-                       if (instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC)) {
-                               Z_OBJ_ADDREF_P(zbody);
+                       if (instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry)) {
+                               Z_ADDREF_P(zbody);
+                               body_obj = PHP_HTTP_OBJ(NULL, zbody);
                                break;
                        }
                        /* no break */
 
                default:
                                break;
                        }
                        /* no break */
 
                default:
-                       tmp = php_http_ztyp(IS_STRING, zbody);
+                       body_str = zval_get_string(zbody);
                        s = php_stream_temp_new();
                        s = php_stream_temp_new();
-                       php_stream_write(s, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
-                       zval_ptr_dtor(&tmp);
-                       tmp = NULL;
+                       php_stream_write(s, body_str->val, body_str->len);
+                       zend_string_release(body_str);
                        goto is_resource;
 
        }
 
                        goto is_resource;
 
        }
 
-       body_obj = zend_object_store_get_object(zbody TSRMLS_CC);
        if (!body_obj->body) {
        if (!body_obj->body) {
-               body_obj->body = php_http_message_body_init(NULL, NULL TSRMLS_CC);
+               body_obj->body = php_http_message_body_init(NULL, NULL);
        }
        if (msg_obj->body) {
        }
        if (msg_obj->body) {
-               zend_objects_store_del_ref_by_handle(msg_obj->body->zv.handle TSRMLS_CC);
+               zend_objects_store_del(&msg_obj->body->zo);
        }
        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 TSRMLS_CC);
+               msg_obj->message->body = php_http_message_body_init(&body_obj->body, NULL);
        } else {
        } else {
-               msg_obj->message = php_http_message_init(NULL, 0, php_http_message_body_init(&body_obj->body, NULL TSRMLS_CC) TSRMLS_CC);
+               msg_obj->message = php_http_message_init(NULL, 0, php_http_message_body_init(&body_obj->body, NULL));
        }
        msg_obj->body = body_obj;
 
        }
        msg_obj->body = body_obj;
 
-       if (tmp) {
-               FREE_ZVAL(tmp);
-       }
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj)
+ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_object_t *obj)
 {
 {
-       TSRMLS_FETCH_FROM_CTX(obj->message->ts);
-
        php_http_message_body_addref(obj->message->body);
        php_http_message_body_addref(obj->message->body);
-       return php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, (void *) &obj->body TSRMLS_CC);
+       return php_http_new((void *) &obj->body, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body);
 }
 
 }
 
-zend_object_value php_http_message_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_message_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_message_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_message_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg, php_http_message_object_t **ptr TSRMLS_DC)
+php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg)
 {
        php_http_message_object_t *o;
 
 {
        php_http_message_object_t *o;
 
-       o = ecalloc(1, sizeof(php_http_message_object_t));
-       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
-
-       if (ptr) {
-               *ptr = o;
-       }
+       o = ecalloc(1, sizeof(php_http_message_object_t) + (ce->default_properties_count - 1) * sizeof(zval));
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
 
        if (msg) {
                o->message = msg;
                if (msg->parent) {
 
        if (msg) {
                o->message = msg;
                if (msg->parent) {
-                       php_http_message_object_new_ex(ce, msg->parent, &o->parent TSRMLS_CC);
+                       o->parent = php_http_message_object_new_ex(ce, msg->parent);
                }
                }
-               php_http_message_body_object_new_ex(php_http_message_body_class_entry, php_http_message_body_init(&msg->body, NULL TSRMLS_CC), &o->body TSRMLS_CC);
+               o->body = php_http_message_body_object_new_ex(php_http_message_body_class_entry, php_http_message_body_init(&msg->body, NULL));
        }
 
        }
 
-       o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_object_free, NULL TSRMLS_CC);
-       o->zv.handlers = &php_http_message_object_handlers;
+       o->zo.handlers = &php_http_message_object_handlers;
 
 
-       return o->zv;
+       return o;
 }
 
 }
 
-zend_object_value php_http_message_object_clone(zval *this_ptr TSRMLS_DC)
+zend_object *php_http_message_object_clone(zval *this_ptr TSRMLS_DC)
 {
 {
-       zend_object_value new_ov;
        php_http_message_object_t *new_obj = NULL;
        php_http_message_object_t *new_obj = NULL;
-       php_http_message_object_t *old_obj = zend_object_store_get_object(this_ptr TSRMLS_CC);
+       php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr);
 
 
-       new_ov = php_http_message_object_new_ex(old_obj->zo.ce, php_http_message_copy(old_obj->message, NULL), &new_obj TSRMLS_CC);
-       zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
+       new_obj = php_http_message_object_new_ex(old_obj->zo.ce, php_http_message_copy(old_obj->message, NULL));
+       zend_objects_clone_members(&new_obj->zo, &old_obj->zo);
 
 
-       return new_ov;
+       return &new_obj->zo;
 }
 
 }
 
-void php_http_message_object_free(void *object TSRMLS_DC)
+void php_http_message_object_free(zend_object *object)
 {
 {
-       php_http_message_object_t *o = (php_http_message_object_t *) object;
+       php_http_message_object_t *o = PHP_HTTP_OBJ(object, NULL);
 
 
-       if (o->iterator) {
+       if (!Z_ISUNDEF(o->iterator)) {
                zval_ptr_dtor(&o->iterator);
                zval_ptr_dtor(&o->iterator);
-               o->iterator = NULL;
+               ZVAL_UNDEF(&o->iterator);
        }
        if (o->message) {
                /* do NOT free recursivly */
        }
        if (o->message) {
                /* do NOT free recursivly */
@@ -881,146 +836,131 @@ void php_http_message_object_free(void *object TSRMLS_DC)
                o->message = NULL;
        }
        if (o->parent) {
                o->message = NULL;
        }
        if (o->parent) {
-               zend_objects_store_del_ref_by_handle(o->parent->zv.handle TSRMLS_CC);
+               zend_objects_store_del(&o->parent->zo);
                o->parent = NULL;
        }
        if (o->body) {
                o->parent = NULL;
        }
        if (o->body) {
-               zend_objects_store_del_ref_by_handle(o->body->zv.handle TSRMLS_CC);
+               zend_objects_store_del(&o->body->zo);
                o->body = NULL;
        }
                o->body = NULL;
        }
-       zend_object_std_dtor((zend_object *) o TSRMLS_CC);
-       efree(o);
+       zend_object_std_dtor(object);
 }
 
 }
 
-static zval *php_http_message_object_read_prop(zval *object, zval *member, int type PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC)
+static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *return_value)
 {
 {
-       php_http_message_object_t *obj = zend_object_store_get_object(object TSRMLS_CC);
+       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
        php_http_message_object_prophandler_t *handler;
        php_http_message_object_prophandler_t *handler;
-       zval *return_value, *copy = php_http_ztyp(IS_STRING, member);
+       zend_string *member_name = zval_get_string(member);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-       if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
-               ALLOC_ZVAL(return_value);
-               Z_SET_REFCOUNT_P(return_value, 0);
-               Z_UNSET_ISREF_P(return_value);
-
+       if ((handler = php_http_message_object_get_prophandler(member_name))) {
                if (type == BP_VAR_R) {
                if (type == BP_VAR_R) {
-                       handler->read(obj, return_value TSRMLS_CC);
+                       handler->read(obj, return_value);
                } else {
                } else {
-                       php_property_proxy_t *proxy = php_property_proxy_init(object, Z_STRVAL_P(copy), Z_STRLEN_P(copy) TSRMLS_CC);
-                       RETVAL_OBJVAL(php_property_proxy_object_new_ex(php_property_proxy_get_class_entry(), proxy, NULL TSRMLS_CC), 0);
+                       php_property_proxy_t *proxy = php_property_proxy_init(object, member_name);
+                       RETVAL_OBJ(&php_property_proxy_object_new_ex(php_property_proxy_get_class_entry(), proxy)->zo);
                }
        } else {
                }
        } else {
-               return_value = zend_get_std_object_handlers()->read_property(object, member, type PHP_HTTP_ZEND_LITERAL_CC TSRMLS_CC);
+               zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, return_value);
        }
 
        }
 
-       zval_ptr_dtor(&copy);
+       zend_string_release(member_name);
 
        return return_value;
 }
 
 
        return return_value;
 }
 
-static void php_http_message_object_write_prop(zval *object, zval *member, zval *value PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC)
+static void php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot)
 {
 {
-       php_http_message_object_t *obj = zend_object_store_get_object(object TSRMLS_CC);
+       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
        php_http_message_object_prophandler_t *handler;
        php_http_message_object_prophandler_t *handler;
-       zval *copy = php_http_ztyp(IS_STRING, member);
+       zend_string *member_name = zval_get_string(member);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-       if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
-               handler->write(obj, value TSRMLS_CC);
+       if ((handler = php_http_message_object_get_prophandler(member_name))) {
+               handler->write(obj, value);
        } else {
        } else {
-               zend_get_std_object_handlers()->write_property(object, member, value PHP_HTTP_ZEND_LITERAL_CC TSRMLS_CC);
+               zend_get_std_object_handlers()->write_property(object, member, value, cache_slot);
        }
 
        }
 
-       zval_ptr_dtor(&copy);
+       zend_string_release(member_name);
 }
 
 }
 
-static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC)
+static HashTable *php_http_message_object_get_props(zval *object)
 {
 {
-       zval *headers;
-       php_http_message_object_t *obj = zend_object_store_get_object(object TSRMLS_CC);
-       HashTable *props = zend_get_std_object_handlers()->get_properties(object TSRMLS_CC);
-       zval array, *parent, *body;
+       zval tmp;
+       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
+       HashTable *props = zend_get_std_object_handlers()->get_properties(object);
        char *ver_str, *url_str = NULL;
        size_t ver_len, url_len = 0;
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
        char *ver_str, *url_str = NULL;
        size_t ver_len, url_len = 0;
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
-       INIT_PZVAL_ARRAY(&array, props);
        
        
-#define ASSOC_PROP(ptype, n, val) \
-       do { \
-               zend_property_info *pi; \
-               if (SUCCESS == zend_hash_find(&obj->zo.ce->properties_info, n, sizeof(n), (void *) &pi)) { \
-                       add_assoc_ ##ptype## _ex(&array, pi->name, pi->name_length + 1, val); \
-               } \
-       } while(0) \
-
-#define ASSOC_STRING(name, val) ASSOC_STRINGL(name, val, strlen(val))
-#define ASSOC_STRINGL(name, val, len) ASSOC_STRINGL_EX(name, val, len, 1)
-#define ASSOC_STRINGL_EX(n, val, len, cpy) \
+#define UPDATE_PROP(name_str, action_with_tmp) \
        do { \
                zend_property_info *pi; \
        do { \
                zend_property_info *pi; \
-               if (SUCCESS == zend_hash_find(&obj->zo.ce->properties_info, n, sizeof(n), (void *) &pi)) { \
-                       add_assoc_stringl_ex(&array, pi->name, pi->name_length + 1, val, len, cpy); \
+               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); \
                } \
        } while(0)
 
                } \
        } while(0)
 
-       ASSOC_PROP(long, "type", obj->message->type);
+       UPDATE_PROP("type", ZVAL_LONG(&tmp, obj->message->type));
+
        ver_len = spprintf(&ver_str, 0, "%u.%u", obj->message->http.version.major, obj->message->http.version.minor);
        ver_len = spprintf(&ver_str, 0, "%u.%u", obj->message->http.version.major, obj->message->http.version.minor);
-       ASSOC_STRINGL_EX("httpVersion", ver_str, ver_len, 0);
+       UPDATE_PROP("httpVersion", ZVAL_STR(&tmp, php_http_cs2zs(ver_str, ver_len)));
 
        switch (obj->message->type) {
                case PHP_HTTP_REQUEST:
 
        switch (obj->message->type) {
                case PHP_HTTP_REQUEST:
-                       ASSOC_PROP(long, "responseCode", 0);
-                       ASSOC_STRINGL("responseStatus", "", 0);
-                       ASSOC_STRING("requestMethod", STR_PTR(obj->message->http.info.request.method));
+                       UPDATE_PROP("responseCode", ZVAL_LONG(&tmp, 0));
+                       UPDATE_PROP("responseStatus", ZVAL_EMPTY_STRING(&tmp));
+                       UPDATE_PROP("requestMethod", ZVAL_STRING(&tmp, STR_PTR(obj->message->http.info.request.method)));
                        if (obj->message->http.info.request.url) {
                                php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0);
                        if (obj->message->http.info.request.url) {
                                php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0);
-                               ASSOC_STRINGL_EX("requestUrl", url_str, url_len, 0);
+                               UPDATE_PROP("requestUrl", ZVAL_STR(&tmp, php_http_cs2zs(url_str, url_len)));
                        } else {
                        } else {
-                               ASSOC_STRINGL("requestUrl", "", 0);
+                               UPDATE_PROP("requestUrl", ZVAL_EMPTY_STRING(&tmp));
                        }
 
                        break;
 
                case PHP_HTTP_RESPONSE:
                        }
 
                        break;
 
                case PHP_HTTP_RESPONSE:
-                       ASSOC_PROP(long, "responseCode", obj->message->http.info.response.code);
-                       ASSOC_STRING("responseStatus", STR_PTR(obj->message->http.info.response.status));
-                       ASSOC_STRINGL("requestMethod", "", 0);
-                       ASSOC_STRINGL("requestUrl", "", 0);
+                       UPDATE_PROP("responseCode", ZVAL_LONG(&tmp, obj->message->http.info.response.code));
+                       UPDATE_PROP("responseStatus", ZVAL_STRING(&tmp, STR_PTR(obj->message->http.info.response.status)));
+                       UPDATE_PROP("requestMethod", ZVAL_EMPTY_STRING(&tmp));
+                       UPDATE_PROP("requestUrl", ZVAL_EMPTY_STRING(&tmp));
                        break;
 
                case PHP_HTTP_NONE:
                default:
                        break;
 
                case PHP_HTTP_NONE:
                default:
-                       ASSOC_PROP(long, "responseCode", 0);
-                       ASSOC_STRINGL("responseStatus", "", 0);
-                       ASSOC_STRINGL("requestMethod", "", 0);
-                       ASSOC_STRINGL("requestUrl", "", 0);
+                       UPDATE_PROP("responseCode", ZVAL_LONG(&tmp, 0));
+                       UPDATE_PROP("responseStatus", ZVAL_EMPTY_STRING(&tmp));
+                       UPDATE_PROP("requestMethod", ZVAL_EMPTY_STRING(&tmp));
+                       UPDATE_PROP("requestUrl", ZVAL_EMPTY_STRING(&tmp));
                        break;
        }
 
                        break;
        }
 
-       MAKE_STD_ZVAL(headers);
-       array_init(headers);
-       zend_hash_copy(Z_ARRVAL_P(headers), &obj->message->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
-       ASSOC_PROP(zval, "headers", headers);
+       UPDATE_PROP("headers",
+                       array_init(&tmp);
+                       array_copy(&obj->message->hdrs, Z_ARRVAL(tmp));
+       );
 
 
-       MAKE_STD_ZVAL(body);
-       if (obj->body) {
-               ZVAL_OBJVAL(body, obj->body->zv, 1);
-       } else {
-               ZVAL_NULL(body);
-       }
-       ASSOC_PROP(zval, "body", body);
+       UPDATE_PROP("body",
+                       if (obj->body) {
+                               ZVAL_OBJECT(&tmp, &obj->body->zo, 1);
+                       } else {
+                               ZVAL_NULL(&tmp);
+                       }
+       );
 
 
-       MAKE_STD_ZVAL(parent);
-       if (obj->message->parent) {
-               ZVAL_OBJVAL(parent, obj->parent->zv, 1);
-       } else {
-               ZVAL_NULL(parent);
-       }
-       ASSOC_PROP(zval, "parentMessage", parent);
+       UPDATE_PROP("parentMessage",
+                       if (obj->message->parent) {
+                               ZVAL_OBJECT(&tmp, &obj->parent->zo, 1);
+                       } else {
+                               ZVAL_NULL(&tmp);
+                       }
+       );
 
        return props;
 }
 
        return props;
 }
@@ -1034,22 +974,22 @@ static PHP_METHOD(HttpMessage, __construct)
        zend_bool greedy = 1;
        zval *zmessage = NULL;
        php_http_message_t *msg = NULL;
        zend_bool greedy = 1;
        zval *zmessage = NULL;
        php_http_message_t *msg = NULL;
-       php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
        zend_error_handling zeh;
 
        zend_error_handling zeh;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!b", &zmessage, &greedy), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z!b", &zmessage, &greedy), invalid_arg, return);
 
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_message_class_entry, &zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_message_class_entry, &zeh);
        if (zmessage && Z_TYPE_P(zmessage) == IS_RESOURCE) {
                php_stream *s;
                php_http_message_parser_t p;
                zend_error_handling zeh;
 
        if (zmessage && Z_TYPE_P(zmessage) == IS_RESOURCE) {
                php_stream *s;
                php_http_message_parser_t p;
                zend_error_handling zeh;
 
-               zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh TSRMLS_CC);
-               php_stream_from_zval(s, &zmessage);
-               zend_restore_error_handling(&zeh TSRMLS_CC);
+               zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh);
+               php_stream_from_zval(s, zmessage);
+               zend_restore_error_handling(&zeh);
 
 
-               if (s && php_http_message_parser_init(&p TSRMLS_CC)) {
+               if (s && php_http_message_parser_init(&p)) {
                        unsigned flags = (greedy ? PHP_HTTP_MESSAGE_PARSER_GREEDY : 0);
                        php_http_buffer_t buf;
 
                        unsigned flags = (greedy ? PHP_HTTP_MESSAGE_PARSER_GREEDY : 0);
                        php_http_buffer_t buf;
 
@@ -1067,23 +1007,24 @@ static PHP_METHOD(HttpMessage, __construct)
                        php_http_throw(bad_message, "Empty message received from stream", NULL);
                }
        } else if (zmessage) {
                        php_http_throw(bad_message, "Empty message received from stream", NULL);
                }
        } else if (zmessage) {
-               zmessage = php_http_ztyp(IS_STRING, zmessage);
-               msg = php_http_message_parse(NULL, Z_STRVAL_P(zmessage), Z_STRLEN_P(zmessage), greedy TSRMLS_CC);
+               zend_string *zs_msg = zval_get_string(zmessage);
+
+               msg = php_http_message_parse(NULL, zs_msg->val, zs_msg->len, greedy);
 
                if (!msg && !EG(exception)) {
 
                if (!msg && !EG(exception)) {
-                       php_http_throw(bad_message, "Could not parse message: %.*s", MIN(25, Z_STRLEN_P(zmessage)), Z_STRVAL_P(zmessage));
+                       php_http_throw(bad_message, "Could not parse message: %.*s", MIN(25, zs_msg->len), zs_msg->len);
                }
                }
-               zval_ptr_dtor(&zmessage);
+               zend_string_release(zs_msg);
        }
 
        if (msg) {
                php_http_message_dtor(obj->message);
                obj->message = msg;
                if (obj->message->parent) {
        }
 
        if (msg) {
                php_http_message_dtor(obj->message);
                obj->message = msg;
                if (obj->message->parent) {
-                       php_http_message_object_new_ex(Z_OBJCE_P(getThis()), obj->message->parent, &obj->parent TSRMLS_CC);
+                       obj->parent = php_http_message_object_new_ex(obj->zo.ce, obj->message->parent);
                }
        }
                }
        }
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_restore_error_handling(&zeh);
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 }
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 }
 
@@ -1095,8 +1036,7 @@ static PHP_METHOD(HttpMessage, getBody)
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!obj->body) {
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!obj->body) {
@@ -1104,7 +1044,7 @@ static PHP_METHOD(HttpMessage, getBody)
 
        }
        if (obj->body) {
 
        }
        if (obj->body) {
-               RETVAL_OBJVAL(obj->body->zv, 1);
+               RETVAL_OBJECT(&obj->body->zo, 1);
        }
 }
 
        }
 }
 
@@ -1115,13 +1055,13 @@ static PHP_METHOD(HttpMessage, setBody)
 {
        zval *zbody;
 
 {
        zval *zbody;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zbody, php_http_message_body_class_entry)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zbody, php_http_message_body_class_entry)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
-               php_http_message_object_prophandler_set_body(obj, zbody TSRMLS_CC);
+               php_http_message_object_prophandler_set_body(obj, zbody);
        }
        }
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
@@ -1131,14 +1071,14 @@ static PHP_METHOD(HttpMessage, addBody)
 {
        zval *new_body;
 
 {
        zval *new_body;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &new_body, php_http_message_body_class_entry)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-               php_http_message_body_object_t *new_obj = zend_object_store_get_object(new_body TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &new_body, php_http_message_body_class_entry)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+               php_http_message_body_object_t *new_obj = PHP_HTTP_OBJ(NULL, new_body);
 
                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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeader, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeader, 0, 0, 1)
@@ -1148,37 +1088,33 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getHeader)
 {
        char *header_str;
 static PHP_METHOD(HttpMessage, getHeader)
 {
        char *header_str;
-       int header_len;
+       size_t header_len;
        zend_class_entry *header_ce = NULL;
 
        zend_class_entry *header_ce = NULL;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|C!", &header_str, &header_len, &header_ce)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|C!", &header_str, &header_len, &header_ce)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                zval *header;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                zval *header;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               if ((header = php_http_message_header(obj->message, header_str, header_len, 0))) {
+               if ((header = php_http_message_header(obj->message, header_str, header_len))) {
                        if (!header_ce) {
                                RETURN_ZVAL(header, 1, 1);
                        if (!header_ce) {
                                RETURN_ZVAL(header, 1, 1);
-                       } else if (instanceof_function(header_ce, php_http_header_class_entry TSRMLS_CC)) {
-                               zval *header_name, **argv[2];
-
-                               MAKE_STD_ZVAL(header_name);
-                               ZVAL_STRINGL(header_name, header_str, header_len, 1);
-                               Z_ADDREF_P(header);
+                       } else if (instanceof_function(header_ce, php_http_header_class_entry)) {
+                               zval argv[2];
 
 
-                               argv[0] = &header_name;
-                               argv[1] = &header;
+                               ZVAL_STRINGL(&argv[0], header_str, header_len);
+                               ZVAL_COPY(&argv[1], header);
 
                                object_init_ex(return_value, header_ce);
 
                                object_init_ex(return_value, header_ce);
-                               php_http_method_call(return_value, ZEND_STRL("__construct"), 2, argv, NULL TSRMLS_CC);
+                               php_http_method_call(return_value, ZEND_STRL("__construct"), 2, argv, NULL);
 
 
-                               zval_ptr_dtor(&header_name);
-                               zval_ptr_dtor(&header);
+                               zval_ptr_dtor(&argv[0]);
+                               zval_ptr_dtor(&argv[1]);
 
                                return;
                        } else {
 
                                return;
                        } else {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Class '%s' is not as descendant of http\\Header", header_ce->name);
+                               php_error_docref(NULL, E_WARNING, "Class '%s' is not as descendant of http\\Header", header_ce->name->val);
                        }
                }
        }
                        }
                }
        }
@@ -1190,7 +1126,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getHeaders)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getHeaders)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1207,23 +1143,23 @@ static PHP_METHOD(HttpMessage, setHeader)
 {
        zval *zvalue = NULL;
        char *name_str;
 {
        zval *zvalue = NULL;
        char *name_str;
-       int name_len;
+       size_t name_len;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!", &name_str, &name_len, &zvalue)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|z!", &name_str, &name_len, &zvalue)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (!zvalue) {
                char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (!zvalue) {
-                       zend_symtable_del(&obj->message->hdrs, name, name_len + 1);
+                       zend_symtable_str_del(&obj->message->hdrs, name, name_len);
                } else {
                } else {
-                       Z_ADDREF_P(zvalue);
-                       zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+                       Z_TRY_ADDREF_P(zvalue);
+                       zend_symtable_str_update(&obj->message->hdrs, name, name_len, zvalue);
                }
                efree(name);
        }
                }
                efree(name);
        }
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
@@ -1233,8 +1169,8 @@ static PHP_METHOD(HttpMessage, setHeaders)
 {
        zval *new_headers = NULL;
 
 {
        zval *new_headers = NULL;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!", &new_headers)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a/!", &new_headers)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1243,7 +1179,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeader, 0, 0, 2)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeader, 0, 0, 2)
@@ -1254,26 +1190,25 @@ static PHP_METHOD(HttpMessage, addHeader)
 {
        zval *zvalue;
        char *name_str;
 {
        zval *zvalue;
        char *name_str;
-       int name_len;
+       size_t name_len;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name_str, &name_len, &zvalue)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &name_str, &name_len, &zvalue)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
                zval *header;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                char *name = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
                zval *header;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               Z_ADDREF_P(zvalue);
-               if ((header = php_http_message_header(obj->message, name, name_len, 0))) {
+               Z_TRY_ADDREF_P(zvalue);
+               if ((header = php_http_message_header(obj->message, name, name_len))) {
                        convert_to_array(header);
                        convert_to_array(header);
-                       zend_hash_next_index_insert(Z_ARRVAL_P(header), &zvalue, sizeof(void *), NULL);
-                       zval_ptr_dtor(&header);
+                       zend_hash_next_index_insert(Z_ARRVAL_P(header), zvalue);
                } else {
                } else {
-                       zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+                       zend_symtable_str_update(&obj->message->hdrs, name, name_len, zvalue);
                }
                efree(name);
        }
                }
                efree(name);
        }
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
@@ -1285,14 +1220,14 @@ static PHP_METHOD(HttpMessage, addHeaders)
        zval *new_headers;
        zend_bool append = 0;
 
        zval *new_headers;
        zend_bool append = 0;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|b", &new_headers, &append)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a|b", &new_headers, &append)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
        }
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                array_join(Z_ARRVAL_P(new_headers), &obj->message->hdrs, append, ARRAY_JOIN_STRONLY|ARRAY_JOIN_PRETTIFY);
        }
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getType, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getType, 0, 0, 0)
@@ -1300,7 +1235,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getType)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getType)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1313,16 +1248,16 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setType, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setType)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setType)
 {
-       long type;
+       zend_long type;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                php_http_message_set_type(obj->message, type);
        }
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                php_http_message_set_type(obj->message, type);
        }
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getInfo, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getInfo, 0, 0, 0)
@@ -1330,26 +1265,27 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getInfo)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getInfo)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               char *tmp = NULL;
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               char *str, *tmp = NULL;
+               size_t len;
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                switch (obj->message->type) {
                        case PHP_HTTP_REQUEST:
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                switch (obj->message->type) {
                        case PHP_HTTP_REQUEST:
-                               Z_STRLEN_P(return_value) = spprintf(&Z_STRVAL_P(return_value), 0, PHP_HTTP_INFO_REQUEST_FMT_ARGS(&obj->message->http, tmp, ""));
+                               len = spprintf(&str, 0, PHP_HTTP_INFO_REQUEST_FMT_ARGS(&obj->message->http, tmp, ""));
                                PTR_FREE(tmp);
                                break;
                        case PHP_HTTP_RESPONSE:
                                PTR_FREE(tmp);
                                break;
                        case PHP_HTTP_RESPONSE:
-                               Z_STRLEN_P(return_value) = spprintf(&Z_STRVAL_P(return_value), 0, PHP_HTTP_INFO_RESPONSE_FMT_ARGS(&obj->message->http, tmp, ""));
+                               len = spprintf(&str, 0, PHP_HTTP_INFO_RESPONSE_FMT_ARGS(&obj->message->http, tmp, ""));
                                PTR_FREE(tmp);
                                break;
                        default:
                                RETURN_NULL();
                                break;
                }
                                PTR_FREE(tmp);
                                break;
                        default:
                                RETURN_NULL();
                                break;
                }
-               Z_TYPE_P(return_value) = IS_STRING;
-               return;
+
+               RETVAL_STR(php_http_cs2zs(str, len));
        }
 }
 
        }
 }
 
@@ -1359,16 +1295,16 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setInfo)
 {
        char *str;
 static PHP_METHOD(HttpMessage, setInfo)
 {
        char *str;
-       int len;
+       size_t len;
        php_http_message_object_t *obj;
        php_http_info_t inf;
 
        php_http_message_object_t *obj;
        php_http_info_t inf;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-       if (!php_http_info_parse(&inf, str TSRMLS_CC)) {
+       if (!php_http_info_parse(&inf, str)) {
                php_http_throw(bad_header, "Could not parse message info '%s'", str);
                return;
        }
                php_http_throw(bad_header, "Could not parse message info '%s'", str);
                return;
        }
@@ -1376,7 +1312,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHttpVersion, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHttpVersion, 0, 0, 0)
@@ -1386,12 +1322,12 @@ static PHP_METHOD(HttpMessage, getHttpVersion)
        if (SUCCESS == zend_parse_parameters_none()) {
                char *str;
                size_t len;
        if (SUCCESS == zend_parse_parameters_none()) {
                char *str;
                size_t len;
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               php_http_version_to_string(&obj->message->http.version, &str, &len, NULL, NULL TSRMLS_CC);
-               RETURN_STRINGL(str, len, 0);
+               php_http_version_to_string(&obj->message->http.version, &str, &len, NULL, NULL);
+               RETURN_STR(php_http_cs2zs(str, len));
        }
 }
 
        }
 }
 
@@ -1401,20 +1337,20 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setHttpVersion)
 {
        char *v_str;
 static PHP_METHOD(HttpMessage, setHttpVersion)
 {
        char *v_str;
-       int v_len;
+       size_t v_len;
        php_http_version_t version;
        php_http_message_object_t *obj;
 
        php_http_version_t version;
        php_http_message_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &v_str, &v_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &v_str, &v_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-       php_http_expect(php_http_version_parse(&version, v_str TSRMLS_CC), unexpected_val, return);
+       php_http_expect(php_http_version_parse(&version, v_str), unexpected_val, return);
 
        obj->message->http.version = version;
 
 
        obj->message->http.version = version;
 
-       RETVAL_ZVAL(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseCode, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseCode, 0, 0, 0)
@@ -1422,12 +1358,12 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getResponseCode)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getResponseCode)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_RESPONSE) {
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_RESPONSE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "http\\Message is not if type response");
+                       php_error_docref(NULL, E_WARNING, "http\\Message is not if type response");
                        RETURN_FALSE;
                }
 
                        RETURN_FALSE;
                }
 
@@ -1441,14 +1377,13 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseCode, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setResponseCode)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setResponseCode)
 {
-       long code;
+       zend_long code;
        zend_bool strict = 1;
        php_http_message_object_t *obj;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &code, &strict), invalid_arg, return);
 
        zend_bool strict = 1;
        php_http_message_object_t *obj;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &code, &strict), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (obj->message->type != PHP_HTTP_RESPONSE) {
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (obj->message->type != PHP_HTTP_RESPONSE) {
@@ -1464,7 +1399,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseStatus, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseStatus, 0, 0, 0)
@@ -1472,16 +1407,16 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getResponseStatus)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getResponseStatus)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_RESPONSE) {
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_RESPONSE) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "http\\Message is not of type response");
+                       php_error_docref(NULL, E_WARNING, "http\\Message is not of type response");
                }
 
                if (obj->message->http.info.response.status) {
                }
 
                if (obj->message->http.info.response.status) {
-                       RETURN_STRING(obj->message->http.info.response.status, 1);
+                       RETURN_STRING(obj->message->http.info.response.status);
                } else {
                        RETURN_EMPTY_STRING();
                }
                } else {
                        RETURN_EMPTY_STRING();
                }
@@ -1499,7 +1434,7 @@ static PHP_METHOD(HttpMessage, setResponseStatus)
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1508,7 +1443,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestMethod, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestMethod, 0, 0, 0)
@@ -1516,17 +1451,17 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getRequestMethod)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getRequestMethod)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_REQUEST) {
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_REQUEST) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "http\\Message is not of type request");
+                       php_error_docref(NULL, E_WARNING, "http\\Message is not of type request");
                        RETURN_FALSE;
                }
 
                if (obj->message->http.info.request.method) {
                        RETURN_FALSE;
                }
 
                if (obj->message->http.info.request.method) {
-                       RETURN_STRING(obj->message->http.info.request.method, 1);
+                       RETURN_STRING(obj->message->http.info.request.method);
                } else {
                        RETURN_EMPTY_STRING();
                }
                } else {
                        RETURN_EMPTY_STRING();
                }
@@ -1539,12 +1474,12 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, setRequestMethod)
 {
        char *method;
 static PHP_METHOD(HttpMessage, setRequestMethod)
 {
        char *method;
-       int method_len;
+       size_t method_len;
        php_http_message_object_t *obj;
 
        php_http_message_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &method, &method_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &method, &method_len), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1559,7 +1494,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestUrl, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestUrl, 0, 0, 0)
@@ -1567,12 +1502,12 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, getRequestUrl)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, getRequestUrl)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_REQUEST) {
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_REQUEST) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "http\\Message is not of type request");
+                       php_error_docref(NULL, E_WARNING, "http\\Message is not of type request");
                        RETURN_FALSE;
                }
 
                        RETURN_FALSE;
                }
 
@@ -1581,7 +1516,7 @@ static PHP_METHOD(HttpMessage, getRequestUrl)
                        size_t url_len;
 
                        php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0);
                        size_t url_len;
 
                        php_http_url_to_string(obj->message->http.info.request.url, &url_str, &url_len, 0);
-                       RETURN_STRINGL(url_str, url_len, 0);
+                       RETURN_STR(php_http_cs2zs(url_str, url_len));
                } else {
                        RETURN_EMPTY_STRING();
                }
                } else {
                        RETURN_EMPTY_STRING();
                }
@@ -1598,9 +1533,9 @@ static PHP_METHOD(HttpMessage, setRequestUrl)
        php_http_message_object_t *obj;
        zend_error_handling zeh;
 
        php_http_message_object_t *obj;
        zend_error_handling zeh;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zurl), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zurl), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
@@ -1609,9 +1544,9 @@ static PHP_METHOD(HttpMessage, setRequestUrl)
                return;
        }
 
                return;
        }
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh TSRMLS_CC);
-       url = php_http_url_from_zval(zurl, ~0 TSRMLS_CC);
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh);
+       url = php_http_url_from_zval(zurl, ~0);
+       zend_restore_error_handling(&zeh);
 
        if (php_http_url_is_empty(url)) {
                php_http_url_free(&url);
 
        if (php_http_url_is_empty(url)) {
                php_http_url_free(&url);
@@ -1620,7 +1555,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(getThis(), 1, 0);
+       RETVAL_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getParentMessage, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getParentMessage, 0, 0, 0)
@@ -1631,8 +1566,7 @@ static PHP_METHOD(HttpMessage, getParentMessage)
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!obj->message->parent) {
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!obj->message->parent) {
@@ -1640,7 +1574,7 @@ static PHP_METHOD(HttpMessage, getParentMessage)
                return;
        }
 
                return;
        }
 
-       RETVAL_OBJVAL(obj->parent->zv, 1);
+       RETVAL_OBJECT(&obj->parent->zo, 1);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0)
@@ -1652,8 +1586,8 @@ static PHP_METHOD(HttpMessage, toString)
 {
        zend_bool include_parent = 0;
 
 {
        zend_bool include_parent = 0;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &include_parent)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &include_parent)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *string;
                size_t length;
 
                char *string;
                size_t length;
 
@@ -1665,7 +1599,7 @@ static PHP_METHOD(HttpMessage, toString)
                        php_http_message_to_string(obj->message, &string, &length);
                }
                if (string) {
                        php_http_message_to_string(obj->message, &string, &length);
                }
                if (string) {
-                       RETURN_STRINGL(string, length, 0);
+                       RETURN_STR(php_http_cs2zs(string, length));
                }
        }
        RETURN_EMPTY_STRING();
                }
        }
        RETURN_EMPTY_STRING();
@@ -1678,13 +1612,13 @@ static PHP_METHOD(HttpMessage, toStream)
 {
        zval *zstream;
 
 {
        zval *zstream;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zstream)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstream)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                php_stream *s;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                php_stream *s;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               php_stream_from_zval(s, &zstream);
+               php_stream_from_zval(s, zstream);
                php_http_message_to_callback(obj->message, (php_http_pass_callback_t) _php_stream_write, s);
        }
 }
                php_http_message_to_callback(obj->message, (php_http_pass_callback_t) _php_stream_write, s);
        }
 }
@@ -1696,20 +1630,17 @@ static PHP_METHOD(HttpMessage, toCallback)
 {
        php_http_pass_fcall_arg_t fcd;
 
 {
        php_http_pass_fcall_arg_t fcd;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fcd.fci, &fcd.fcc)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "f", &fcd.fci, &fcd.fcc)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               fcd.fcz = getThis();
-               Z_ADDREF_P(fcd.fcz);
-               TSRMLS_SET_CTX(fcd.ts);
-
+               ZVAL_COPY(&fcd.fcz, getThis());
                php_http_message_to_callback(obj->message, php_http_pass_fcall_callback, &fcd);
                zend_fcall_info_args_clear(&fcd.fci, 1);
                php_http_message_to_callback(obj->message, php_http_pass_fcall_callback, &fcd);
                zend_fcall_info_args_clear(&fcd.fci, 1);
-
                zval_ptr_dtor(&fcd.fcz);
                zval_ptr_dtor(&fcd.fcz);
-               RETURN_ZVAL(getThis(), 1, 0);
+
+               RETURN_ZVAL_FAST(getThis());
        }
 }
 
        }
 }
 
@@ -1718,14 +1649,14 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, serialize)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, serialize)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *string;
                size_t length;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                php_http_message_serialize(obj->message, &string, &length);
                char *string;
                size_t length;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                php_http_message_serialize(obj->message, &string, &length);
-               RETURN_STRINGL(string, length, 0);
+               RETURN_STR(php_http_cs2zs(string, length));
        }
        RETURN_EMPTY_STRING();
 }
        }
        RETURN_EMPTY_STRING();
 }
@@ -1735,21 +1666,22 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_unserialize, 0, 0, 1)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, unserialize)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, unserialize)
 {
-       int length;
+       size_t length;
        char *serialized;
 
        char *serialized;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &length)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &length)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                php_http_message_t *msg;
 
                if (obj->message) {
                php_http_message_t *msg;
 
                if (obj->message) {
+                       /* do not free recursively */
                        php_http_message_dtor(obj->message);
                        efree(obj->message);
                }
                        php_http_message_dtor(obj->message);
                        efree(obj->message);
                }
-               if ((msg = php_http_message_parse(NULL, serialized, (size_t) length, 1 TSRMLS_CC))) {
+               if ((msg = php_http_message_parse(NULL, serialized, length, 1))) {
                        obj->message = msg;
                } else {
                        obj->message = msg;
                } else {
-                       obj->message = php_http_message_init(NULL, 0, NULL TSRMLS_CC);
+                       obj->message = php_http_message_init(NULL, 0, NULL);
                        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not unserialize http\\Message");
                }
        }
                        php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not unserialize http\\Message");
                }
        }
@@ -1759,15 +1691,18 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_detach, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, detach)
 {
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, detach)
 {
-       php_http_message_object_t *obj;
+       php_http_message_object_t *obj, *new_obj;
+       php_http_message_t *msg_cpy;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-       RETVAL_OBJVAL(php_http_message_object_new_ex(obj->zo.ce, php_http_message_copy_ex(obj->message, NULL, 0), NULL TSRMLS_CC), 0);
+       msg_cpy = php_http_message_copy_ex(obj->message, NULL, 0);
+       new_obj = php_http_message_object_new_ex(obj->zo.ce, msg_cpy);
+
+       RETVAL_OBJ(&new_obj->zo);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_prepend, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_prepend, 0, 0, 1)
@@ -1781,11 +1716,11 @@ static PHP_METHOD(HttpMessage, prepend)
        php_http_message_t *msg[2];
        php_http_message_object_t *obj, *prepend_obj;
 
        php_http_message_t *msg[2];
        php_http_message_object_t *obj, *prepend_obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &prepend, php_http_message_class_entry, &top), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &prepend, php_http_message_class_entry, &top), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
-       prepend_obj = zend_object_store_get_object(prepend TSRMLS_CC);
+       prepend_obj = PHP_HTTP_OBJ(NULL, prepend);
        PHP_HTTP_MESSAGE_OBJECT_INIT(prepend_obj);
 
        /* safety check */
        PHP_HTTP_MESSAGE_OBJECT_INIT(prepend_obj);
 
        /* safety check */
@@ -1798,8 +1733,8 @@ static PHP_METHOD(HttpMessage, prepend)
                }
        }
 
                }
        }
 
-       php_http_message_object_prepend(getThis(), prepend, top TSRMLS_CC);
-       RETURN_ZVAL(getThis(), 1, 0);
+       php_http_message_object_prepend(getThis(), prepend, top);
+       RETURN_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_reverse, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_reverse, 0, 0, 0)
@@ -1808,7 +1743,7 @@ static PHP_METHOD(HttpMessage, reverse)
 {
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 {
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       php_http_message_object_reverse(getThis(), return_value TSRMLS_CC);
+       php_http_message_object_reverse(getThis(), return_value);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_isMultipart, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_isMultipart, 0, 0, 0)
@@ -1818,17 +1753,21 @@ static PHP_METHOD(HttpMessage, isMultipart)
 {
        zval *zboundary = NULL;
 
 {
        zval *zboundary = NULL;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &zboundary)) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z!", &zboundary)) {
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *boundary = NULL;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                char *boundary = NULL;
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               RETVAL_BOOL(php_http_message_is_multipart(obj->message, zboundary ? &boundary : NULL));
+               if (php_http_message_is_multipart(obj->message, zboundary ? &boundary : NULL)) {
+                       RETVAL_TRUE;
+               } else {
+                       RETVAL_FALSE;
+               }
 
                if (zboundary && boundary) {
                        zval_dtor(zboundary);
 
                if (zboundary && boundary) {
                        zval_dtor(zboundary);
-                       ZVAL_STRING(zboundary, boundary, 0);
+                       ZVAL_STR(zboundary, php_http_cs2zs(boundary, strlen(boundary)));
                }
        }
 }
                }
        }
 }
@@ -1843,8 +1782,7 @@ static PHP_METHOD(HttpMessage, splitMultipartBody)
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!php_http_message_is_multipart(obj->message, &boundary)) {
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
        if (!php_http_message_is_multipart(obj->message, &boundary)) {
@@ -1856,23 +1794,21 @@ static PHP_METHOD(HttpMessage, splitMultipartBody)
 
        PTR_FREE(boundary);
 
 
        PTR_FREE(boundary);
 
-       RETURN_OBJVAL(php_http_message_object_new_ex(php_http_message_class_entry, msg, NULL TSRMLS_CC), 0);
+       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_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, count)
 {
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, count)
 {
-       long count_mode = -1;
+       zend_long count_mode = -1;
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
-               long i = 0;
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
-               php_http_message_count(i, obj->message);
-               RETURN_LONG(i);
+               RETURN_LONG(php_http_message_count(obj->message));
        }
 }
 
        }
 }
 
@@ -1882,13 +1818,12 @@ static PHP_METHOD(HttpMessage, rewind)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
                zval *zobj = getThis();
 {
        if (SUCCESS == zend_parse_parameters_none()) {
                zval *zobj = getThis();
-               php_http_message_object_t *obj = zend_object_store_get_object(zobj TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-               if (obj->iterator) {
+               if (!Z_ISUNDEF(obj->iterator)) {
                        zval_ptr_dtor(&obj->iterator);
                }
                        zval_ptr_dtor(&obj->iterator);
                }
-               Z_ADDREF_P(zobj);
-               obj->iterator = zobj;
+               ZVAL_COPY(&obj->iterator, zobj);
        }
 }
 
        }
 }
 
@@ -1897,9 +1832,9 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, valid)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, valid)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-               RETURN_BOOL(obj->iterator != NULL);
+               RETURN_BOOL(!Z_ISUNDEF(obj->iterator));
        }
 }
 
        }
 }
 
@@ -1908,19 +1843,20 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, next)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, next)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-               if (obj->iterator) {
-                       php_http_message_object_t *itr = zend_object_store_get_object(obj->iterator TSRMLS_CC);
+               if (!Z_ISUNDEF(obj->iterator)) {
+                       php_http_message_object_t *itr = PHP_HTTP_OBJ(NULL, &obj->iterator);
 
 
-                       if (itr && itr->parent) {
-                               zval *old = obj->iterator;
-                               MAKE_STD_ZVAL(obj->iterator);
-                               ZVAL_OBJVAL(obj->iterator, itr->parent->zv, 1);
-                               zval_ptr_dtor(&old);
+                       if (itr->parent) {
+                               zval tmp;
+
+                               ZVAL_OBJECT(&tmp, &itr->parent->zo, 1);
+                               zval_ptr_dtor(&obj->iterator);
+                               obj->iterator = tmp;
                        } else {
                                zval_ptr_dtor(&obj->iterator);
                        } else {
                                zval_ptr_dtor(&obj->iterator);
-                               obj->iterator = NULL;
+                               ZVAL_UNDEF(&obj->iterator);
                        }
                }
        }
                        }
                }
        }
@@ -1931,9 +1867,9 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, key)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, key)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-               RETURN_LONG(obj->iterator ? obj->iterator->value.obj.handle:0);
+               RETURN_LONG(Z_ISUNDEF(obj->iterator) ? 0 : Z_OBJ_HANDLE(obj->iterator));
        }
 }
 
        }
 }
 
@@ -1942,10 +1878,10 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessage, current)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 static PHP_METHOD(HttpMessage, current)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
 
-               if (obj->iterator) {
-                       RETURN_ZVAL(obj->iterator, 1, 0);
+               if (!Z_ISUNDEF(obj->iterator)) {
+                       RETURN_ZVAL_FAST(&obj->iterator);
                }
        }
 }
                }
        }
 }
@@ -2013,40 +1949,42 @@ PHP_MINIT_FUNCTION(http_message)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Message", php_http_message_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "Message", php_http_message_methods);
-       php_http_message_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_message_class_entry = zend_register_internal_class(&ce);
        php_http_message_class_entry->create_object = php_http_message_object_new;
        memcpy(&php_http_message_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_message_class_entry->create_object = php_http_message_object_new;
        memcpy(&php_http_message_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+       php_http_message_object_handlers.offset = XtOffsetOf(php_http_message_object_t, zo);
        php_http_message_object_handlers.clone_obj = php_http_message_object_clone;
        php_http_message_object_handlers.clone_obj = php_http_message_object_clone;
+       php_http_message_object_handlers.dtor_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_property_ptr_ptr = NULL;
 
        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_property_ptr_ptr = NULL;
 
-       zend_class_implements(php_http_message_class_entry TSRMLS_CC, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
+       zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
 
        zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, NULL, 1);
 
        zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, NULL, 1);
-       zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("type"), php_http_message_object_prophandler_get_type, php_http_message_object_prophandler_set_type);
        php_http_message_object_add_prophandler(ZEND_STRL("type"), php_http_message_object_prophandler_get_type, php_http_message_object_prophandler_set_type);
-       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("body"), ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("body"), ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("body"), php_http_message_object_prophandler_get_body, php_http_message_object_prophandler_set_body);
        php_http_message_object_add_prophandler(ZEND_STRL("body"), php_http_message_object_prophandler_get_body, php_http_message_object_prophandler_set_body);
-       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestMethod"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestMethod"), "", ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("requestMethod"), php_http_message_object_prophandler_get_request_method, php_http_message_object_prophandler_set_request_method);
        php_http_message_object_add_prophandler(ZEND_STRL("requestMethod"), php_http_message_object_prophandler_get_request_method, php_http_message_object_prophandler_set_request_method);
-       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestUrl"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestUrl"), "", ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("requestUrl"), php_http_message_object_prophandler_get_request_url, php_http_message_object_prophandler_set_request_url);
        php_http_message_object_add_prophandler(ZEND_STRL("requestUrl"), php_http_message_object_prophandler_get_request_url, php_http_message_object_prophandler_set_request_url);
-       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("responseStatus"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("responseStatus"), "", ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("responseStatus"), php_http_message_object_prophandler_get_response_status, php_http_message_object_prophandler_set_response_status);
        php_http_message_object_add_prophandler(ZEND_STRL("responseStatus"), php_http_message_object_prophandler_get_response_status, php_http_message_object_prophandler_set_response_status);
-       zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("responseCode"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("responseCode"), 0, ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("responseCode"), php_http_message_object_prophandler_get_response_code, php_http_message_object_prophandler_set_response_code);
        php_http_message_object_add_prophandler(ZEND_STRL("responseCode"), php_http_message_object_prophandler_get_response_code, php_http_message_object_prophandler_set_response_code);
-       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("httpVersion"), ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("httpVersion"), ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("httpVersion"), php_http_message_object_prophandler_get_http_version, php_http_message_object_prophandler_set_http_version);
        php_http_message_object_add_prophandler(ZEND_STRL("httpVersion"), php_http_message_object_prophandler_get_http_version, php_http_message_object_prophandler_set_http_version);
-       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("headers"), ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("headers"), ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("headers"), php_http_message_object_prophandler_get_headers, php_http_message_object_prophandler_set_headers);
        php_http_message_object_add_prophandler(ZEND_STRL("headers"), php_http_message_object_prophandler_get_headers, php_http_message_object_prophandler_set_headers);
-       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("parentMessage"), ZEND_ACC_PROTECTED TSRMLS_CC);
+       zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("parentMessage"), ZEND_ACC_PROTECTED);
        php_http_message_object_add_prophandler(ZEND_STRL("parentMessage"), php_http_message_object_prophandler_get_parent_message, php_http_message_object_prophandler_set_parent_message);
 
        php_http_message_object_add_prophandler(ZEND_STRL("parentMessage"), php_http_message_object_prophandler_get_parent_message, php_http_message_object_prophandler_set_parent_message);
 
-       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_NONE"), PHP_HTTP_NONE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_REQUEST"), PHP_HTTP_REQUEST TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_RESPONSE"), PHP_HTTP_RESPONSE TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_NONE"), PHP_HTTP_NONE);
+       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_REQUEST"), PHP_HTTP_REQUEST);
+       zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_RESPONSE"), PHP_HTTP_RESPONSE);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index 6524a27ccb22661b5c9ae026225ccb3b30686655..2f995074173add6e49d33d058e6180f12be1c052 100644 (file)
@@ -14,6 +14,7 @@
 #define PHP_HTTP_MESSAGE_H
 
 #include "php_http_message_body.h"
 #define PHP_HTTP_MESSAGE_H
 
 #include "php_http_message_body.h"
+#include "php_http_header.h"
 
 /* required minimum length of an HTTP message "HTTP/1.1" */
 #define PHP_HTTP_MESSAGE_MIN_SIZE 8
 
 /* required minimum length of an HTTP message "HTTP/1.1" */
 #define PHP_HTTP_MESSAGE_MIN_SIZE 8
@@ -28,17 +29,18 @@ struct php_http_message {
        php_http_message_body_t *body;
        php_http_message_t *parent;
        void *opaque;
        php_http_message_body_t *body;
        php_http_message_t *parent;
        void *opaque;
-#ifdef ZTS
-       void ***ts;
-#endif
 };
 
 };
 
-PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC);
+PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info);
 
 
-PHP_HTTP_API php_http_message_t *php_http_message_init(php_http_message_t *m, php_http_message_type_t t, php_http_message_body_t *body TSRMLS_DC);
-PHP_HTTP_API php_http_message_t *php_http_message_init_env(php_http_message_t *m, php_http_message_type_t t TSRMLS_DC);
-PHP_HTTP_API php_http_message_t *php_http_message_copy(php_http_message_t *from, php_http_message_t *to);
+PHP_HTTP_API php_http_message_t *php_http_message_init(php_http_message_t *m, php_http_message_type_t t, php_http_message_body_t *body);
+PHP_HTTP_API php_http_message_t *php_http_message_init_env(php_http_message_t *m, php_http_message_type_t t);
 PHP_HTTP_API php_http_message_t *php_http_message_copy_ex(php_http_message_t *from, php_http_message_t *to, zend_bool parents);
 PHP_HTTP_API php_http_message_t *php_http_message_copy_ex(php_http_message_t *from, php_http_message_t *to, zend_bool parents);
+static inline php_http_message_t *php_http_message_copy(php_http_message_t *from, php_http_message_t *to)
+{
+       return php_http_message_copy_ex(from, to, 1);
+}
+
 PHP_HTTP_API void php_http_message_dtor(php_http_message_t *message);
 PHP_HTTP_API void php_http_message_free(php_http_message_t **message);
 
 PHP_HTTP_API void php_http_message_dtor(php_http_message_t *message);
 PHP_HTTP_API void php_http_message_free(php_http_message_t **message);
 
@@ -47,7 +49,18 @@ PHP_HTTP_API void php_http_message_set_info(php_http_message_t *message, php_htt
 
 PHP_HTTP_API void php_http_message_update_headers(php_http_message_t *msg);
 
 
 PHP_HTTP_API void php_http_message_update_headers(php_http_message_t *msg);
 
-PHP_HTTP_API zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len, int join);
+PHP_HTTP_API zval *php_http_message_header(php_http_message_t *msg, const char *key_str, size_t key_len);
+
+static inline zend_string *php_http_message_header_string(php_http_message_t *msg, const char *key_str, size_t key_len)
+{
+       zval *header;
+
+       if ((header = php_http_message_header(msg, key_str, key_len))) {
+               return php_http_header_value_to_string(header);
+       }
+       return NULL;
+}
+
 PHP_HTTP_API zend_bool php_http_message_is_multipart(php_http_message_t *msg, char **boundary);
 
 PHP_HTTP_API void php_http_message_to_string(php_http_message_t *msg, char **string, size_t *length);
 PHP_HTTP_API zend_bool php_http_message_is_multipart(php_http_message_t *msg, char **boundary);
 
 PHP_HTTP_API void php_http_message_to_string(php_http_message_t *msg, char **string, size_t *length);
@@ -58,21 +71,25 @@ PHP_HTTP_API void php_http_message_serialize(php_http_message_t *message, char *
 PHP_HTTP_API php_http_message_t *php_http_message_reverse(php_http_message_t *msg);
 PHP_HTTP_API php_http_message_t *php_http_message_zip(php_http_message_t *one, php_http_message_t *two);
 
 PHP_HTTP_API php_http_message_t *php_http_message_reverse(php_http_message_t *msg);
 PHP_HTTP_API php_http_message_t *php_http_message_zip(php_http_message_t *one, php_http_message_t *two);
 
-#define php_http_message_count(c, m) \
-{ \
-       php_http_message_t *__tmp_msg = (m); \
-       for (c = 0; __tmp_msg; __tmp_msg = __tmp_msg->parent, ++(c)); \
+static inline size_t php_http_message_count(php_http_message_t *m)
+{
+       size_t c = 1;
+
+       while ((m = m->parent)) {
+               ++c;
+       }
+
+       return c;
 }
 
 }
 
-PHP_HTTP_API php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len, zend_bool greedy TSRMLS_DC);
+PHP_HTTP_API php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len, zend_bool greedy);
 
 typedef struct php_http_message_object {
 
 typedef struct php_http_message_object {
-       zend_object zo;
-       zend_object_value zv;
        php_http_message_t *message;
        struct php_http_message_object *parent;
        php_http_message_body_object_t *body;
        php_http_message_t *message;
        struct php_http_message_object *parent;
        php_http_message_body_object_t *body;
-       zval *iterator;
+       zval iterator;
+       zend_object zo;
 } php_http_message_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_class_entry;
 } php_http_message_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_class_entry;
@@ -80,15 +97,15 @@ PHP_HTTP_API zend_class_entry *php_http_message_class_entry;
 PHP_MINIT_FUNCTION(http_message);
 PHP_MSHUTDOWN_FUNCTION(http_message);
 
 PHP_MINIT_FUNCTION(http_message);
 PHP_MSHUTDOWN_FUNCTION(http_message);
 
-void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top /* = 1 */ TSRMLS_DC);
-void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC);
-STATUS php_http_message_object_set_body(php_http_message_object_t *obj, zval *zbody TSRMLS_DC);
-STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj);
+void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top /* = 1 */);
+void php_http_message_object_reverse(zval *this_ptr, zval *return_value);
+ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *obj, zval *zbody);
+ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_object_t *obj);
 
 
-zend_object_value php_http_message_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg, php_http_message_object_t **ptr TSRMLS_DC);
-zend_object_value php_http_message_object_clone(zval *object TSRMLS_DC);
-void php_http_message_object_free(void *object TSRMLS_DC);
+zend_object *php_http_message_object_new(zend_class_entry *ce);
+php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg);
+zend_object *php_http_message_object_clone(zval *object);
+void php_http_message_object_free(zend_object *object);
 
 #endif
 
 
 #endif
 
index 84e84e4abece2361aef9bd0727dd87bd9153b3b0..b5f03c24604d424da006f1af326828edd81b11ac 100644 (file)
 #define BOUNDARY_CLOSE(body) \
                php_http_message_body_appendf(body, PHP_HTTP_CRLF "--%s--" PHP_HTTP_CRLF, php_http_message_body_boundary(body))
 
 #define BOUNDARY_CLOSE(body) \
                php_http_message_body_appendf(body, PHP_HTTP_CRLF "--%s--" PHP_HTTP_CRLF, php_http_message_body_boundary(body))
 
-static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value);
-static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value);
+static ZEND_RESULT_CODE add_recursive_fields(php_http_message_body_t *body, const char *name, HashTable *fields);
+static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const char *name, HashTable *files);
 
 
-php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body_ptr, php_stream *stream TSRMLS_DC)
+php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body_ptr, php_stream *stream)
 {
        php_http_message_body_t *body;
 
 {
        php_http_message_body_t *body;
 
@@ -46,14 +46,13 @@ php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **bo
 
        if (stream) {
                php_stream_auto_cleanup(stream);
 
        if (stream) {
                php_stream_auto_cleanup(stream);
-               body->stream_id = php_stream_get_resource_id(stream);
-               zend_list_addref(body->stream_id);
+               body->res = stream->res;
+               ++GC_REFCOUNT(body->res);
        } else {
                stream = php_stream_temp_create(TEMP_STREAM_DEFAULT, 0xffff);
                php_stream_auto_cleanup(stream);
        } else {
                stream = php_stream_temp_create(TEMP_STREAM_DEFAULT, 0xffff);
                php_stream_auto_cleanup(stream);
-               body->stream_id = php_stream_get_resource_id(stream);
+               body->res = stream->res;
        }
        }
-       TSRMLS_SET_CTX(body->ts);
 
        if (body_ptr) {
                *body_ptr = body;
 
        if (body_ptr) {
                *body_ptr = body;
@@ -70,12 +69,10 @@ unsigned php_http_message_body_addref(php_http_message_body_t *body)
 php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to)
 {
        if (from) {
 php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to)
 {
        if (from) {
-               TSRMLS_FETCH_FROM_CTX(from->ts);
-               
                if (to) {
                        php_stream_truncate_set_size(php_http_message_body_stream(to), 0);
                } else {
                if (to) {
                        php_stream_truncate_set_size(php_http_message_body_stream(to), 0);
                } else {
-                       to = php_http_message_body_init(NULL, NULL TSRMLS_CC);
+                       to = php_http_message_body_init(NULL, NULL);
                }
                php_http_message_body_to_stream(from, php_http_message_body_stream(to), 0, 0);
 
                }
                php_http_message_body_to_stream(from, php_http_message_body_stream(to), 0, 0);
 
@@ -97,9 +94,8 @@ void php_http_message_body_free(php_http_message_body_t **body_ptr)
                php_http_message_body_t *body = *body_ptr;
 
                if (!--body->refcount) {
                php_http_message_body_t *body = *body_ptr;
 
                if (!--body->refcount) {
-                       TSRMLS_FETCH_FROM_CTX(body->ts);
                        /* NOFIXME: shows leakinfo in DEBUG mode */
                        /* NOFIXME: shows leakinfo in DEBUG mode */
-                       zend_list_delete(body->stream_id);
+                       zend_list_delete(body->res);
                        PTR_FREE(body->boundary);
                        efree(body);
                }
                        PTR_FREE(body->boundary);
                        efree(body);
                }
@@ -109,7 +105,6 @@ void php_http_message_body_free(php_http_message_body_t **body_ptr)
 
 const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body)
 {
 
 const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
        php_stream_stat(php_http_message_body_stream(body), &body->ssb);
        return &body->ssb;
 }
        php_stream_stat(php_http_message_body_stream(body), &body->ssb);
        return &body->ssb;
 }
@@ -118,7 +113,6 @@ const char *php_http_message_body_boundary(php_http_message_body_t *body)
 {
        if (!body->boundary) {
                union { double dbl; int num[2]; } data;
 {
        if (!body->boundary) {
                union { double dbl; int num[2]; } data;
-               TSRMLS_FETCH_FROM_CTX(body->ts);
 
                data.dbl = php_combined_lcg(TSRMLS_C);
                spprintf(&body->boundary, 0, "%x.%x", data.num[0], data.num[1]);
 
                data.dbl = php_combined_lcg(TSRMLS_C);
                spprintf(&body->boundary, 0, "%x.%x", data.num[0], data.num[1]);
@@ -129,16 +123,15 @@ const char *php_http_message_body_boundary(php_http_message_body_t *body)
 char *php_http_message_body_etag(php_http_message_body_t *body)
 {
        const php_stream_statbuf *ssb = php_http_message_body_stat(body);
 char *php_http_message_body_etag(php_http_message_body_t *body)
 {
        const php_stream_statbuf *ssb = php_http_message_body_stat(body);
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        /* real file or temp buffer ? */
 
        /* real file or temp buffer ? */
-       if (ssb && ssb->sb.st_mtime) {
+       if (ssb->sb.st_mtime) {
                char *etag;
 
                spprintf(&etag, 0, "%lx-%lx-%lx", ssb->sb.st_ino, ssb->sb.st_mtime, ssb->sb.st_size);
                return etag;
        } else {
                char *etag;
 
                spprintf(&etag, 0, "%lx-%lx-%lx", ssb->sb.st_ino, ssb->sb.st_mtime, ssb->sb.st_size);
                return etag;
        } else {
-               php_http_etag_t *etag = php_http_etag_init(PHP_HTTP_G->env.etag_mode TSRMLS_CC);
+               php_http_etag_t *etag = php_http_etag_init(PHP_HTTP_G->env.etag_mode);
 
                if (etag) {
                        php_http_message_body_to_callback(body, (php_http_pass_callback_t) php_http_etag_update, etag, 0, 0);
 
                if (etag) {
                        php_http_message_body_to_callback(body, (php_http_pass_callback_t) php_http_etag_update, etag, 0, 0);
@@ -149,22 +142,20 @@ char *php_http_message_body_etag(php_http_message_body_t *body)
        }
 }
 
        }
 }
 
-void php_http_message_body_to_string(php_http_message_body_t *body, char **buf, size_t *len, off_t offset, size_t forlen)
+zend_string *php_http_message_body_to_string(php_http_message_body_t *body, off_t offset, size_t forlen)
 {
        php_stream *s = php_http_message_body_stream(body);
 {
        php_stream *s = php_http_message_body_stream(body);
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_stream_seek(s, offset, SEEK_SET);
        if (!forlen) {
                forlen = -1;
        }
 
        php_stream_seek(s, offset, SEEK_SET);
        if (!forlen) {
                forlen = -1;
        }
-       *len = php_stream_copy_to_mem(s, buf, forlen, 0);
+       return php_stream_copy_to_mem(s, forlen, 0);
 }
 
 }
 
-STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen)
+ZEND_RESULT_CODE php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen)
 {
        php_stream *s = php_http_message_body_stream(body);
 {
        php_stream *s = php_http_message_body_stream(body);
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_stream_seek(s, offset, SEEK_SET);
 
 
        php_stream_seek(s, offset, SEEK_SET);
 
@@ -174,11 +165,10 @@ STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream
        return php_stream_copy_to_stream_ex(s, dst, forlen, NULL);
 }
 
        return php_stream_copy_to_stream_ex(s, dst, forlen, NULL);
 }
 
-STATUS php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen)
+ZEND_RESULT_CODE php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen)
 {
        php_stream *s = php_http_message_body_stream(body);
        char *buf = emalloc(0x1000);
 {
        php_stream *s = php_http_message_body_stream(body);
        char *buf = emalloc(0x1000);
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_stream_seek(s, offset, SEEK_SET);
 
 
        php_stream_seek(s, offset, SEEK_SET);
 
@@ -211,7 +201,6 @@ size_t php_http_message_body_append(php_http_message_body_t *body, const char *b
 {
        php_stream *s;
        size_t written;
 {
        php_stream *s;
        size_t written;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        if (!(s = php_http_message_body_stream(body))) {
                return -1;
 
        if (!(s = php_http_message_body_stream(body))) {
                return -1;
@@ -246,19 +235,15 @@ size_t php_http_message_body_appendf(php_http_message_body_t *body, const char *
        return print_len;
 }
 
        return print_len;
 }
 
-STATUS php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files)
+ZEND_RESULT_CODE php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files)
 {
 {
-       zval tmp;
-
        if (fields) {
        if (fields) {
-               INIT_PZVAL_ARRAY(&tmp, fields);
-               if (SUCCESS != add_recursive_fields(body, NULL, &tmp)) {
+               if (SUCCESS != add_recursive_fields(body, NULL, fields)) {
                        return FAILURE;
                }
        }
        if (files) {
                        return FAILURE;
                }
        }
        if (files) {
-               INIT_PZVAL_ARRAY(&tmp, files);
-               if (SUCCESS != add_recursive_files(body, NULL, &tmp)) {
+               if (SUCCESS != add_recursive_files(body, NULL, files)) {
                        return FAILURE;
                }
        }
                        return FAILURE;
                }
        }
@@ -268,44 +253,40 @@ STATUS php_http_message_body_add_form(php_http_message_body_t *body, HashTable *
 
 void php_http_message_body_add_part(php_http_message_body_t *body, php_http_message_t *part)
 {
 
 void php_http_message_body_add_part(php_http_message_body_t *body, php_http_message_t *part)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
-
        BOUNDARY_OPEN(body);
        php_http_message_to_callback(part, (php_http_pass_callback_t) php_http_message_body_append, body);
        BOUNDARY_CLOSE(body);
 }
 
 
        BOUNDARY_OPEN(body);
        php_http_message_to_callback(part, (php_http_pass_callback_t) php_http_message_body_append, body);
        BOUNDARY_CLOSE(body);
 }
 
 
-STATUS php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len)
+ZEND_RESULT_CODE php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len)
 {
 {
-       char *safe_name;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
+       zend_string *safe_name;
 
 
-       safe_name = php_addslashes(estrdup(name), strlen(name), NULL, 1 TSRMLS_CC);
+       safe_name = php_addslashes(estrdup(name), strlen(name), 1);
 
        BOUNDARY_OPEN(body);
        php_http_message_body_appendf(
                body,
                "Content-Disposition: form-data; name=\"%s\"" PHP_HTTP_CRLF
                "" PHP_HTTP_CRLF,
 
        BOUNDARY_OPEN(body);
        php_http_message_body_appendf(
                body,
                "Content-Disposition: form-data; name=\"%s\"" PHP_HTTP_CRLF
                "" PHP_HTTP_CRLF,
-               safe_name
+               safe_name->val
        );
        php_http_message_body_append(body, value_str, value_len);
        BOUNDARY_CLOSE(body);
 
        );
        php_http_message_body_append(body, value_str, value_len);
        BOUNDARY_CLOSE(body);
 
-       efree(safe_name);
+       zend_string_release(safe_name);
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-STATUS php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *path, php_stream *in)
+ZEND_RESULT_CODE php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *path, php_stream *in)
 {
 {
-       char *safe_name, *path_dup = estrdup(path), *bname;
-       size_t bname_len;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
+       size_t path_len = strlen(path);
+       char *path_dup = estrndup(path, path_len);
+       zend_string *safe_name, *base_name;
 
 
-       safe_name = php_addslashes(estrdup(name), strlen(name), NULL, 1 TSRMLS_CC);
-       
-       php_basename(path_dup, strlen(path_dup), NULL, 0, &bname, &bname_len TSRMLS_CC); 
+       safe_name = php_addslashes(estrdup(name), strlen(name), 1);
+       base_name = php_basename(path_dup, path_len, NULL, 0);
 
        BOUNDARY_OPEN(body);
        php_http_message_body_appendf(
 
        BOUNDARY_OPEN(body);
        php_http_message_body_appendf(
@@ -314,29 +295,29 @@ STATUS php_http_message_body_add_form_file(php_http_message_body_t *body, const
                "Content-Transfer-Encoding: binary" PHP_HTTP_CRLF
                "Content-Type: %s" PHP_HTTP_CRLF
                PHP_HTTP_CRLF,
                "Content-Transfer-Encoding: binary" PHP_HTTP_CRLF
                "Content-Type: %s" PHP_HTTP_CRLF
                PHP_HTTP_CRLF,
-               safe_name, bname, ctype
+               safe_name->val, base_name->val, ctype
        );
        php_stream_copy_to_stream_ex(in, php_http_message_body_stream(body), PHP_STREAM_COPY_ALL, NULL);
        BOUNDARY_CLOSE(body);
 
        );
        php_stream_copy_to_stream_ex(in, php_http_message_body_stream(body), PHP_STREAM_COPY_ALL, NULL);
        BOUNDARY_CLOSE(body);
 
-       efree(safe_name);
+       zend_string_release(safe_name);
+       zend_string_release(base_name);
        efree(path_dup);
        efree(path_dup);
-       efree(bname);
 
        return SUCCESS;
 }
 
 
        return SUCCESS;
 }
 
-static inline char *format_key(uint type, char *str, ulong num, const char *prefix) {
+static inline char *format_key(php_http_arrkey_t *key, const char *prefix) {
        char *new_key = NULL;
 
        if (prefix && *prefix) {
        char *new_key = NULL;
 
        if (prefix && *prefix) {
-               if (type == HASH_KEY_IS_STRING) {
-                       spprintf(&new_key, 0, "%s[%s]", prefix, str);
+               if (key->key) {
+                       spprintf(&new_key, 0, "%s[%s]", prefix, key->key->val);
                } else {
                } else {
-                       spprintf(&new_key, 0, "%s[%lu]", prefix, num);
+                       spprintf(&new_key, 0, "%s[%lu]", prefix, key->h);
                }
                }
-       } else if (type == HASH_KEY_IS_STRING) {
-               new_key = estrdup(str);
+       } else if (key->key) {
+               new_key = estrdup(key->key->val);
        } else {
                new_key = estrdup("");
        }
        } else {
                new_key = estrdup("");
        }
@@ -344,106 +325,108 @@ static inline char *format_key(uint type, char *str, ulong num, const char *pref
        return new_key;
 }
 
        return new_key;
 }
 
-static STATUS add_recursive_fields(php_http_message_body_t *body, const char *name, zval *value)
+static ZEND_RESULT_CODE add_recursive_field_value(php_http_message_body_t *body, const char *name, zval *value)
+{
+       zend_string *zs = zval_get_string(value);
+       ZEND_RESULT_CODE rc = php_http_message_body_add_form_field(body, name, zs->val, zs->len);
+       zend_string_release(zs);
+       return rc;
+}
+
+static ZEND_RESULT_CODE add_recursive_fields(php_http_message_body_t *body, const char *name, HashTable *fields)
 {
 {
-       if (Z_TYPE_P(value) == IS_ARRAY || Z_TYPE_P(value) == IS_OBJECT) {
-               zval **val;
-               HashTable *ht;
-               HashPosition pos;
-               php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-               TSRMLS_FETCH_FROM_CTX(body->ts);
+       zval *val;
+       php_http_arrkey_t key;
+
+       if (!ZEND_HASH_GET_APPLY_COUNT(fields)) {
+               ZEND_HASH_INC_APPLY_COUNT(fields);
+               ZEND_HASH_FOREACH_KEY_VAL(fields, key.h, key.key, val)
+               {
+                       char *str = format_key(&key, name);
 
 
-               ht = HASH_OF(value);
-               if (!ht->nApplyCount) {
-                       ++ht->nApplyCount;
-                       FOREACH_KEYVAL(pos, value, key, val) {
-                               char *str = format_key(key.type, key.str, key.num, name);
-                               if (SUCCESS != add_recursive_fields(body, str, *val)) {
+                       if (Z_TYPE_P(val) != IS_ARRAY && Z_TYPE_P(val) != IS_OBJECT) {
+                               if (SUCCESS != add_recursive_field_value(body, str, val)) {
                                        efree(str);
                                        efree(str);
-                                       ht->nApplyCount--;
+                                       ZEND_HASH_DEC_APPLY_COUNT(fields);
                                        return FAILURE;
                                }
                                        return FAILURE;
                                }
+                       } else if (SUCCESS != add_recursive_fields(body, str, HASH_OF(val))) {
                                efree(str);
                                efree(str);
+                               ZEND_HASH_DEC_APPLY_COUNT(fields);
+                               return FAILURE;
                        }
                        }
-                       --ht->nApplyCount;
+                       efree(str);
                }
                }
-       } else {
-               zval *cpy = php_http_ztyp(IS_STRING, value);
-               php_http_message_body_add_form_field(body, name, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy));
-               zval_ptr_dtor(&cpy);
+               ZEND_HASH_FOREACH_END();
+               ZEND_HASH_DEC_APPLY_COUNT(fields);
        }
 
        return SUCCESS;
 }
 
        }
 
        return SUCCESS;
 }
 
-static STATUS add_recursive_files(php_http_message_body_t *body, const char *name, zval *value)
+static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const char *name, HashTable *files)
 {
 {
-       zval **zdata = NULL, **zfile, **zname, **ztype;
-       HashTable *ht;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
-
-       if (Z_TYPE_P(value) != IS_ARRAY && Z_TYPE_P(value) != IS_OBJECT) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected array or object (name, type, file) for message body file to add");
-               return FAILURE;
-       }
-
-       ht = HASH_OF(value);
+       zval *zdata = NULL, *zfile, *zname, *ztype;
 
 
-       if ((SUCCESS != zend_hash_find(ht, ZEND_STRS("name"), (void *) &zname))
-       ||      (SUCCESS != zend_hash_find(ht, ZEND_STRS("type"), (void *) &ztype))
-       ||      (SUCCESS != zend_hash_find(ht, ZEND_STRS("file"), (void *) &zfile))
+       /* single entry */
+       if (!(zname = zend_hash_str_find(files, ZEND_STRL("name")))
+       ||      !(ztype = zend_hash_str_find(files, ZEND_STRL("type")))
+       ||      !(zfile = zend_hash_str_find(files, ZEND_STRL("file")))
        ) {
        ) {
-               zval **val;
-               HashPosition pos;
-               php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+               zval *val;
+               php_http_arrkey_t key;
 
 
-               if (!ht->nApplyCount) {
-                       ++ht->nApplyCount;
-                       FOREACH_HASH_KEYVAL(pos, ht, key, val) {
-                               if (Z_TYPE_PP(val) == IS_ARRAY || Z_TYPE_PP(val) == IS_OBJECT) {
-                                       char *str = format_key(key.type, key.str, key.num, name);
+               if (!ZEND_HASH_GET_APPLY_COUNT(files)) {
+                       ZEND_HASH_INC_APPLY_COUNT(files);
+                       ZEND_HASH_FOREACH_KEY_VAL(files, key.h, key.key, val)
+                       {
+                               if (Z_TYPE_P(val) == IS_ARRAY || Z_TYPE_P(val) == IS_OBJECT) {
+                                       char *str = format_key(&key, name);
 
 
-                                       if (SUCCESS != add_recursive_files(body, str, *val)) {
+                                       if (SUCCESS != add_recursive_files(body, str, HASH_OF(val))) {
                                                efree(str);
                                                efree(str);
-                                               --ht->nApplyCount;
+                                               ZEND_HASH_DEC_APPLY_COUNT(files);
                                                return FAILURE;
                                        }
                                        efree(str);
                                }
                        }
                                                return FAILURE;
                                        }
                                        efree(str);
                                }
                        }
-                       --ht->nApplyCount;
+                       ZEND_HASH_FOREACH_END();
+                       ZEND_HASH_DEC_APPLY_COUNT(files);
                }
                return SUCCESS;
        } else {
                }
                return SUCCESS;
        } else {
+               /* stream entry */
                php_stream *stream;
                php_stream *stream;
-               zval *zfc = php_http_ztyp(IS_STRING, *zfile);
+               zend_string *zfc = zval_get_string(zfile);
 
 
-               if (SUCCESS == zend_hash_find(ht, ZEND_STRS("data"), (void *) &zdata)) {
-                       if (Z_TYPE_PP(zdata) == IS_RESOURCE) {
+               if ((zdata = zend_hash_str_find(files, ZEND_STRL("data")))) {
+                       if (Z_TYPE_P(zdata) == IS_RESOURCE) {
                                php_stream_from_zval_no_verify(stream, zdata);
                        } else {
                                php_stream_from_zval_no_verify(stream, zdata);
                        } else {
-                               zval *tmp = php_http_ztyp(IS_STRING, *zdata);
+                               zend_string *tmp = zval_get_string(zdata);
 
 
-                               stream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
-                               zval_ptr_dtor(&tmp);
+                               stream = php_stream_memory_open(TEMP_STREAM_READONLY, tmp->val, tmp->len);
+                               zend_string_release(tmp);
                        }
                } else {
                        }
                } else {
-                       stream = php_stream_open_wrapper(Z_STRVAL_P(zfc), "r", REPORT_ERRORS|USE_PATH, NULL);
+                       stream = php_stream_open_wrapper(zfc->val, "r", REPORT_ERRORS|USE_PATH, NULL);
                }
 
                if (!stream) {
                }
 
                if (!stream) {
-                       zval_ptr_dtor(&zfc);
+                       zend_string_release(zfc);
                        return FAILURE;
                } else {
                        return FAILURE;
                } else {
-                       zval *znc = php_http_ztyp(IS_STRING, *zname), *ztc = php_http_ztyp(IS_STRING, *ztype);
-                       char *key = format_key(HASH_KEY_IS_STRING, Z_STRVAL_P(znc), 0, name);
-                       STATUS ret =  php_http_message_body_add_form_file(body, key, Z_STRVAL_P(ztc), Z_STRVAL_P(zfc), stream);
+                       zend_string *znc = zval_get_string(zname), *ztc = zval_get_string(ztype);
+                       php_http_arrkey_t arrkey = {0, znc};
+                       char *key = format_key(&arrkey, name);
+                       ZEND_RESULT_CODE ret = php_http_message_body_add_form_file(body, key, ztc->val, zfc->val, stream);
 
                        efree(key);
 
                        efree(key);
-                       zval_ptr_dtor(&znc);
-                       zval_ptr_dtor(&ztc);
-                       zval_ptr_dtor(&zfc);
-                       if (!zdata || Z_TYPE_PP(zdata) != IS_RESOURCE) {
+                       zend_string_release(znc);
+                       zend_string_release(ztc);
+                       zend_string_release(zfc);
+                       if (!zdata || Z_TYPE_P(zdata) != IS_RESOURCE) {
                                php_stream_close(stream);
                        }
                        return ret;
                                php_stream_close(stream);
                        }
                        return ret;
@@ -460,7 +443,7 @@ struct splitbody_arg {
        size_t consumed;
 };
 
        size_t consumed;
 };
 
-static size_t splitbody(void *opaque, char *buf, size_t len TSRMLS_DC)
+static size_t splitbody(void *opaque, char *buf, size_t len)
 {
        struct splitbody_arg *arg = opaque;
        const char *boundary = NULL;
 {
        struct splitbody_arg *arg = opaque;
        const char *boundary = NULL;
@@ -503,7 +486,7 @@ static size_t splitbody(void *opaque, char *buf, size_t len TSRMLS_DC)
                                        /* advance messages */
                                        php_http_message_t *msg;
 
                                        /* advance messages */
                                        php_http_message_t *msg;
 
-                                       msg = php_http_message_init(NULL, 0, NULL TSRMLS_CC);
+                                       msg = php_http_message_init(NULL, 0, NULL);
                                        msg->parent = arg->parser->message;
                                        arg->parser->message = msg;
                                }
                                        msg->parent = arg->parser->message;
                                        arg->parser->message = msg;
                                }
@@ -515,7 +498,7 @@ static size_t splitbody(void *opaque, char *buf, size_t len TSRMLS_DC)
                                        len = 0;
                                } else {
                                        /* let this be garbage */
                                        len = 0;
                                } else {
                                        /* let this be garbage */
-                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Malformed multipart boundary at pos %zu", consumed);
+                                       php_error_docref(NULL, E_WARNING, "Malformed multipart boundary at pos %zu", consumed);
                                        return -1;
                                }
                        }
                                        return -1;
                                }
                        }
@@ -539,16 +522,15 @@ php_http_message_t *php_http_message_body_split(php_http_message_body_t *body, c
        php_http_buffer_t *tmp = NULL;
        php_http_message_t *msg = NULL;
        struct splitbody_arg arg;
        php_http_buffer_t *tmp = NULL;
        php_http_message_t *msg = NULL;
        struct splitbody_arg arg;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_http_buffer_init(&arg.buf);
 
        php_http_buffer_init(&arg.buf);
-       arg.parser = php_http_message_parser_init(NULL TSRMLS_CC);
+       arg.parser = php_http_message_parser_init(NULL);
        arg.boundary_len = spprintf(&arg.boundary_str, 0, "\n--%s", boundary);
        arg.consumed = 0;
 
        php_stream_rewind(s);
        while (!php_stream_eof(s)) {
        arg.boundary_len = spprintf(&arg.boundary_str, 0, "\n--%s", boundary);
        arg.consumed = 0;
 
        php_stream_rewind(s);
        while (!php_stream_eof(s)) {
-               php_http_buffer_passthru(&tmp, 0x1000, (php_http_buffer_pass_func_t) _php_stream_read, s, splitbody, &arg TSRMLS_CC);
+               php_http_buffer_passthru(&tmp, 0x1000, (php_http_buffer_pass_func_t) _php_stream_read, s, splitbody, &arg);
        }
 
        msg = arg.parser->message;
        }
 
        msg = arg.parser->message;
@@ -564,59 +546,52 @@ php_http_message_t *php_http_message_body_split(php_http_message_body_t *body, c
 
 static zend_object_handlers php_http_message_body_object_handlers;
 
 
 static zend_object_handlers php_http_message_body_object_handlers;
 
-zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_message_body_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_message_body_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_message_body_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC)
+php_http_message_body_object_t *php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body)
 {
        php_http_message_body_object_t *o;
 
 {
        php_http_message_body_object_t *o;
 
-       o = ecalloc(1, sizeof(php_http_message_body_object_t));
-       zend_object_std_init((zend_object *) o, php_http_message_body_class_entry TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
-
-       if (ptr) {
-               *ptr = o;
-       }
+       o = ecalloc(1, sizeof(php_http_message_body_object_t) + (ce->default_properties_count - 1) * sizeof(zval));
+       zend_object_std_init(&o->zo, php_http_message_body_class_entry);
+       object_properties_init(&o->zo, ce);
 
        if (body) {
                o->body = body;
        }
 
 
        if (body) {
                o->body = body;
        }
 
-       o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_body_object_free, NULL TSRMLS_CC);
-       o->zv.handlers = &php_http_message_body_object_handlers;
+       o->zo.handlers = &php_http_message_body_object_handlers;
 
 
-       return o->zv;
+       return o;
 }
 
 }
 
-zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC)
+zend_object *php_http_message_body_object_clone(zval *object)
 {
 {
-       zend_object_value new_ov;
        php_http_message_body_object_t *new_obj = NULL;
        php_http_message_body_object_t *new_obj = NULL;
-       php_http_message_body_object_t *old_obj = zend_object_store_get_object(object TSRMLS_CC);
+       php_http_message_body_object_t *old_obj = PHP_HTTP_OBJ(NULL, object);
        php_http_message_body_t *body = php_http_message_body_copy(old_obj->body, NULL);
 
        php_http_message_body_t *body = php_http_message_body_copy(old_obj->body, NULL);
 
-       new_ov = php_http_message_body_object_new_ex(old_obj->zo.ce, body, &new_obj TSRMLS_CC);
-       zend_objects_clone_members(&new_obj->zo, new_ov, &old_obj->zo, Z_OBJ_HANDLE_P(object) TSRMLS_CC);
+       new_obj = php_http_message_body_object_new_ex(old_obj->zo.ce, body);
+       zend_objects_clone_members(&new_obj->zo, &old_obj->zo);
 
 
-       return new_ov;
+       return &new_obj->zo;
 }
 
 }
 
-void php_http_message_body_object_free(void *object TSRMLS_DC)
+void php_http_message_body_object_free(zend_object *object)
 {
 {
-       php_http_message_body_object_t *obj = object;
+       php_http_message_body_object_t *obj = PHP_HTTP_OBJ(object, NULL);
 
        php_http_message_body_free(&obj->body);
 
        php_http_message_body_free(&obj->body);
-       zend_object_std_dtor((zend_object *) obj TSRMLS_CC);
-       efree(obj);
+       zend_object_std_dtor(object TSRMLS_CC);
 }
 
 #define PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj) \
        do { \
                if (!obj->body) { \
 }
 
 #define PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj) \
        do { \
                if (!obj->body) { \
-                       obj->body = php_http_message_body_init(NULL, NULL TSRMLS_CC); \
+                       obj->body = php_http_message_body_init(NULL, NULL); \
                } \
        } while(0)
 
                } \
        } while(0)
 
@@ -625,19 +600,19 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody___construct, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, __construct)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, __construct)
 {
-       php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
        zval *zstream = NULL;
        php_stream *stream;
 
        zval *zstream = NULL;
        php_stream *stream;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r!", &zstream), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|r!", &zstream), invalid_arg, return);
 
        if (zstream) {
 
        if (zstream) {
-               php_http_expect(php_stream_from_zval_no_verify(stream, &zstream), unexpected_val, return);
+               php_http_expect(php_stream_from_zval_no_verify(stream, zstream), unexpected_val, return);
 
                if (obj->body) {
                        php_http_message_body_free(&obj->body);
                }
 
                if (obj->body) {
                        php_http_message_body_free(&obj->body);
                }
-               obj->body = php_http_message_body_init(NULL, stream TSRMLS_CC);
+               obj->body = php_http_message_body_init(NULL, stream);
        }
 }
 
        }
 }
 
@@ -646,15 +621,14 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, __toString)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 PHP_METHOD(HttpMessageBody, __toString)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-               char *str;
-               size_t len;
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
+               zend_string *zs;
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
-               php_http_message_body_to_string(obj->body, &str, &len, 0, 0);
-               if (str) {
-                       RETURN_STRINGL(str, len, 0);
+               zs = php_http_message_body_to_string(obj->body, 0, 0);
+               if (zs) {
+                       RETURN_STR(zs);
                }
        }
        RETURN_EMPTY_STRING();
                }
        }
        RETURN_EMPTY_STRING();
@@ -666,13 +640,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, unserialize)
 {
        char *us_str;
 PHP_METHOD(HttpMessageBody, unserialize)
 {
        char *us_str;
-       int us_len;
+       size_t 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);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &us_str, &us_len)) {
+               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_stream_memory_open(0, us_str, us_len);
 
-               obj->body = php_http_message_body_init(NULL, s TSRMLS_CC);
+               obj->body = php_http_message_body_init(NULL, s);
        }
 }
 
        }
 }
 
@@ -684,15 +658,15 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, toStream)
 {
        zval *zstream;
 PHP_METHOD(HttpMessageBody, toStream)
 {
        zval *zstream;
-       long offset = 0, forlen = 0;
+       zend_long offset = 0, forlen = 0;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ll", &zstream, &offset, &forlen)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "r|ll", &zstream, &offset, &forlen)) {
                php_stream *stream;
                php_stream *stream;
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
-               php_stream_from_zval(stream, &zstream);
+               php_stream_from_zval(stream, zstream);
                php_http_message_body_to_stream(obj->body, stream, offset, forlen);
                RETURN_ZVAL(getThis(), 1, 0);
        }
                php_http_message_body_to_stream(obj->body, stream, offset, forlen);
                RETURN_ZVAL(getThis(), 1, 0);
        }
@@ -706,22 +680,18 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, toCallback)
 {
        php_http_pass_fcall_arg_t fcd;
 PHP_METHOD(HttpMessageBody, toCallback)
 {
        php_http_pass_fcall_arg_t fcd;
-       long offset = 0, forlen = 0;
+       zend_long offset = 0, forlen = 0;
 
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f|ll", &fcd.fci, &fcd.fcc, &offset, &forlen)) {
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "f|ll", &fcd.fci, &fcd.fcc, &offset, &forlen)) {
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
-               fcd.fcz = getThis();
-               Z_ADDREF_P(fcd.fcz);
-               TSRMLS_SET_CTX(fcd.ts);
-
+               ZVAL_COPY(&fcd.fcz, getThis());
                php_http_message_body_to_callback(obj->body, php_http_pass_fcall_callback, &fcd, offset, forlen);
                zend_fcall_info_args_clear(&fcd.fci, 1);
                php_http_message_body_to_callback(obj->body, php_http_pass_fcall_callback, &fcd, offset, forlen);
                zend_fcall_info_args_clear(&fcd.fci, 1);
-
                zval_ptr_dtor(&fcd.fcz);
                zval_ptr_dtor(&fcd.fcz);
-               RETURN_ZVAL(getThis(), 1, 0);
+               RETURN_ZVAL_FAST(getThis());
        }
 }
 
        }
 }
 
@@ -730,12 +700,12 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, getResource)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 PHP_METHOD(HttpMessageBody, getResource)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
-               zend_list_addref(obj->body->stream_id);
-               RETVAL_RESOURCE(obj->body->stream_id);
+               ++GC_REFCOUNT(obj->body->res);
+               RETVAL_RES(obj->body->res);
        }
 }
 
        }
 }
 
@@ -744,12 +714,12 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, getBoundary)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 PHP_METHOD(HttpMessageBody, getBoundary)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_body_object_t * obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_body_object_t * obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
                if (obj->body->boundary) {
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
                if (obj->body->boundary) {
-                       RETURN_STRING(obj->body->boundary, 1);
+                       RETURN_STRING(obj->body->boundary);
                }
        }
 }
                }
        }
 }
@@ -760,18 +730,17 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, append)
 {
        char *str;
 PHP_METHOD(HttpMessageBody, append)
 {
        char *str;
-       int len;
+       size_t len;
        php_http_message_body_object_t *obj;
 
        php_http_message_body_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len), invalid_arg, return);
-
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len), invalid_arg, return);
 
 
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
        php_http_expect(len == php_http_message_body_append(obj->body, str, len), runtime, return);
 
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
        php_http_expect(len == php_http_message_body_append(obj->body, str, len), runtime, return);
 
-       RETURN_ZVAL(getThis(), 1, 0);
+       RETURN_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addForm, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addForm, 0, 0, 0)
@@ -783,15 +752,14 @@ PHP_METHOD(HttpMessageBody, addForm)
        HashTable *fields = NULL, *files = NULL;
        php_http_message_body_object_t *obj;
 
        HashTable *fields = NULL, *files = NULL;
        php_http_message_body_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &fields, &files), invalid_arg, return);
-
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|h!h!", &fields, &files), invalid_arg, return);
 
 
+       obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
        php_http_expect(SUCCESS == php_http_message_body_add_form(obj->body, fields, files), runtime, return);
 
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
        php_http_expect(SUCCESS == php_http_message_body_add_form(obj->body, fields, files), runtime, return);
 
-       RETURN_ZVAL(getThis(), 1, 0);
+       RETURN_ZVAL_FAST(getThis());
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addPart, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addPart, 0, 0, 1)
@@ -804,19 +772,19 @@ PHP_METHOD(HttpMessageBody, addPart)
        php_http_message_object_t *mobj;
        zend_error_handling zeh;
 
        php_http_message_object_t *mobj;
        zend_error_handling zeh;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobj, php_http_message_class_entry), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zobj, php_http_message_class_entry), invalid_arg, return);
 
 
-       obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-       mobj = zend_object_store_get_object(zobj TSRMLS_CC);
+       obj = PHP_HTTP_OBJ(NULL, getThis());
+       mobj = PHP_HTTP_OBJ(NULL, zobj);
 
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
 
        PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_runtime_class_entry, &zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_runtime_class_entry, &zeh);
        php_http_message_body_add_part(obj->body, mobj->message);
        php_http_message_body_add_part(obj->body, mobj->message);
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_restore_error_handling(&zeh);
 
        if (!EG(exception)) {
 
        if (!EG(exception)) {
-               RETURN_ZVAL(getThis(), 1, 0);
+               RETURN_ZVAL_FAST(getThis());
        }
 }
 
        }
 }
 
@@ -825,13 +793,13 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, etag)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
 PHP_METHOD(HttpMessageBody, etag)
 {
        if (SUCCESS == zend_parse_parameters_none()) {
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                char *etag;
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
                if ((etag = php_http_message_body_etag(obj->body))) {
                char *etag;
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
 
                if ((etag = php_http_message_body_etag(obj->body))) {
-                       RETURN_STRING(etag, 0);
+                       RETURN_STR(php_http_cs2zs(etag, strlen(etag)));
                } else {
                        RETURN_FALSE;
                }
                } else {
                        RETURN_FALSE;
                }
@@ -844,10 +812,10 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpMessageBody, stat)
 {
        char *field_str = NULL;
 PHP_METHOD(HttpMessageBody, stat)
 {
        char *field_str = NULL;
-       int field_len = 0;
+       size_t field_len = 0;
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_str, &field_len)) {
 
        if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_str, &field_len)) {
-               php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+               php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
                const php_stream_statbuf *sb;
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
                const php_stream_statbuf *sb;
 
                PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
@@ -872,15 +840,15 @@ PHP_METHOD(HttpMessageBody, stat)
                                                        RETURN_LONG(sb->sb.st_ctime);
                                                        break;
                                                default:
                                                        RETURN_LONG(sb->sb.st_ctime);
                                                        break;
                                                default:
-                                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown stat field: '%s' (should be one of [s]ize, [a]time, [m]time or [c]time)", field_str);
+                                                       php_error_docref(NULL, E_WARNING, "Unknown stat field: '%s' (should be one of [s]ize, [a]time, [m]time or [c]time)", field_str);
                                                        break;
                                        }
                        } else {
                                object_init(return_value);
                                                        break;
                                        }
                        } else {
                                object_init(return_value);
-                               add_property_long_ex(return_value, ZEND_STRS("size"), sb->sb.st_size TSRMLS_CC);
-                               add_property_long_ex(return_value, ZEND_STRS("atime"), sb->sb.st_atime TSRMLS_CC);
-                               add_property_long_ex(return_value, ZEND_STRS("mtime"), sb->sb.st_mtime TSRMLS_CC);
-                               add_property_long_ex(return_value, ZEND_STRS("ctime"), sb->sb.st_ctime TSRMLS_CC);
+                               add_property_long_ex(return_value, ZEND_STRL("size"), sb->sb.st_size);
+                               add_property_long_ex(return_value, ZEND_STRL("atime"), sb->sb.st_atime);
+                               add_property_long_ex(return_value, ZEND_STRL("mtime"), sb->sb.st_mtime);
+                               add_property_long_ex(return_value, ZEND_STRL("ctime"), sb->sb.st_ctime);
                        }
                }
        }
                        }
                }
        }
@@ -911,11 +879,12 @@ PHP_MINIT_FUNCTION(http_message_body)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Message", "Body", php_http_message_body_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Message", "Body", php_http_message_body_methods);
-       php_http_message_body_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_message_body_class_entry = zend_register_internal_class(&ce);
        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;
        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);
+       php_http_message_body_object_handlers.dtor_obj = php_http_message_body_object_free;
+       zend_class_implements(php_http_message_body_class_entry, 1, zend_ce_serializable);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index 860cd8a1d2d686bcb4f148fd18360b56448f9042..92353f7319e48f89daeed35922dd3f02dbc00602 100644 (file)
 #define PHP_HTTP_MESSAGE_BODY_H
 
 typedef struct php_http_message_body {
 #define PHP_HTTP_MESSAGE_BODY_H
 
 typedef struct php_http_message_body {
-       int stream_id;
        php_stream_statbuf ssb;
        php_stream_statbuf ssb;
+       zend_resource *res;
        char *boundary;
        unsigned refcount;
        char *boundary;
        unsigned refcount;
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_message_body_t;
 
 struct php_http_message;
 
 } php_http_message_body_t;
 
 struct php_http_message;
 
-PHP_HTTP_API php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body, php_stream *stream TSRMLS_DC);
+PHP_HTTP_API php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **body, php_stream *stream);
 PHP_HTTP_API unsigned php_http_message_body_addref(php_http_message_body_t *body);
 PHP_HTTP_API php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to);
 PHP_HTTP_API unsigned php_http_message_body_addref(php_http_message_body_t *body);
 PHP_HTTP_API php_http_message_body_t *php_http_message_body_copy(php_http_message_body_t *from, php_http_message_body_t *to);
-PHP_HTTP_API STATUS php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files);
-PHP_HTTP_API STATUS php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len);
-PHP_HTTP_API STATUS php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *file, php_stream *stream);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form(php_http_message_body_t *body, HashTable *fields, HashTable *files);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_add_form_file(php_http_message_body_t *body, const char *name, const char *ctype, const char *file, php_stream *stream);
 PHP_HTTP_API void php_http_message_body_add_part(php_http_message_body_t *body, struct php_http_message *part);
 PHP_HTTP_API size_t php_http_message_body_append(php_http_message_body_t *body, const char *buf, size_t len);
 PHP_HTTP_API size_t php_http_message_body_appendf(php_http_message_body_t *body, const char *fmt, ...);
 PHP_HTTP_API void php_http_message_body_add_part(php_http_message_body_t *body, struct php_http_message *part);
 PHP_HTTP_API size_t php_http_message_body_append(php_http_message_body_t *body, const char *buf, size_t len);
 PHP_HTTP_API size_t php_http_message_body_appendf(php_http_message_body_t *body, const char *fmt, ...);
-PHP_HTTP_API void php_http_message_body_to_string(php_http_message_body_t *body, char **buf, size_t *len, off_t offset, size_t forlen);
-PHP_HTTP_API STATUS php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *s, off_t offset, size_t forlen);
-PHP_HTTP_API STATUS php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen);
+PHP_HTTP_API zend_string *php_http_message_body_to_string(php_http_message_body_t *body, off_t offset, size_t forlen);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *s, off_t offset, size_t forlen);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_message_body_to_callback(php_http_message_body_t *body, php_http_pass_callback_t cb, void *cb_arg, off_t offset, size_t forlen);
 PHP_HTTP_API void php_http_message_body_free(php_http_message_body_t **body);
 PHP_HTTP_API const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body);
 PHP_HTTP_API void php_http_message_body_free(php_http_message_body_t **body);
 PHP_HTTP_API const php_stream_statbuf *php_http_message_body_stat(php_http_message_body_t *body);
-#define php_http_message_body_size(b) (php_http_message_body_stat((b))->sb.st_size)
-#define php_http_message_body_mtime(b) (php_http_message_body_stat((b))->sb.st_mtime)
 PHP_HTTP_API char *php_http_message_body_etag(php_http_message_body_t *body);
 PHP_HTTP_API const char *php_http_message_body_boundary(php_http_message_body_t *body);
 PHP_HTTP_API struct php_http_message *php_http_message_body_split(php_http_message_body_t *body, const char *boundary);
 
 PHP_HTTP_API char *php_http_message_body_etag(php_http_message_body_t *body);
 PHP_HTTP_API const char *php_http_message_body_boundary(php_http_message_body_t *body);
 PHP_HTTP_API struct php_http_message *php_http_message_body_split(php_http_message_body_t *body, const char *boundary);
 
+static inline size_t php_http_message_body_size(php_http_message_body_t *b)
+{
+       return php_http_message_body_stat(b)->sb.st_size;
+}
+
+static inline time_t php_http_message_body_mtime(php_http_message_body_t *b)
+{
+       return php_http_message_body_stat(b)->sb.st_mtime;
+}
+
 static inline php_stream *php_http_message_body_stream(php_http_message_body_t *body)
 {
 static inline php_stream *php_http_message_body_stream(php_http_message_body_t *body)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
-       return zend_fetch_resource(NULL TSRMLS_CC, body->stream_id, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream());
+       return body->res->ptr;
 }
 
 typedef struct php_http_message_body_object {
 }
 
 typedef struct php_http_message_body_object {
-       zend_object zo;
-       zend_object_value zv;
        php_http_message_body_t *body;
        php_http_message_body_t *body;
+       zend_object zo;
 } php_http_message_body_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_body_class_entry;
 PHP_MINIT_FUNCTION(http_message_body);
 
 } php_http_message_body_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_body_class_entry;
 PHP_MINIT_FUNCTION(http_message_body);
 
-zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC);
-zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC);
-void php_http_message_body_object_free(void *object TSRMLS_DC);
+zend_object *php_http_message_body_object_new(zend_class_entry *ce);
+php_http_message_body_object_t *php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body);
+zend_object *php_http_message_body_object_clone(zval *object);
+void php_http_message_body_object_free(zend_object *object);
 
 #endif
 
 
 #endif
 
index 57805eccc396267785b3efdc65f104f7003f7cf8..ba43f08f74f9b9b0d8efda5e333098243a4d6f9d 100644 (file)
@@ -44,16 +44,14 @@ const char *php_http_message_parser_state_name(php_http_message_parser_state_t s
 }
 #endif
 
 }
 #endif
 
-php_http_message_parser_t *php_http_message_parser_init(php_http_message_parser_t *parser TSRMLS_DC)
+php_http_message_parser_t *php_http_message_parser_init(php_http_message_parser_t *parser)
 {
        if (!parser) {
                parser = emalloc(sizeof(*parser));
        }
        memset(parser, 0, sizeof(*parser));
 
 {
        if (!parser) {
                parser = emalloc(sizeof(*parser));
        }
        memset(parser, 0, sizeof(*parser));
 
-       TSRMLS_SET_CTX(parser->ts);
-
-       php_http_header_parser_init(&parser->header TSRMLS_CC);
+       php_http_header_parser_init(&parser->header);
 
        return parser;
 }
 
        return parser;
 }
@@ -118,11 +116,11 @@ void php_http_message_parser_free(php_http_message_parser_t **parser)
 php_http_message_parser_state_t php_http_message_parser_parse_stream(php_http_message_parser_t *parser, php_http_buffer_t *buf, php_stream *s, unsigned flags, php_http_message_t **message)
 {
        php_http_message_parser_state_t state = PHP_HTTP_MESSAGE_PARSER_STATE_START;
 php_http_message_parser_state_t php_http_message_parser_parse_stream(php_http_message_parser_t *parser, php_http_buffer_t *buf, php_stream *s, unsigned flags, php_http_message_t **message)
 {
        php_http_message_parser_state_t state = PHP_HTTP_MESSAGE_PARSER_STATE_START;
-       TSRMLS_FETCH_FROM_CTX(parser->ts);
 
        if (!buf->data) {
                php_http_buffer_resize_ex(buf, 0x1000, 1, 0);
        }
 
        if (!buf->data) {
                php_http_buffer_resize_ex(buf, 0x1000, 1, 0);
        }
+
        while (!php_stream_eof(s)) {
                size_t justread = 0;
 #if DBG_PARSER
        while (!php_stream_eof(s)) {
                size_t justread = 0;
 #if DBG_PARSER
@@ -193,7 +191,6 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
        char *str = NULL;
        size_t len = 0;
        size_t cut = 0;
        char *str = NULL;
        size_t len = 0;
        size_t cut = 0;
-       TSRMLS_FETCH_FROM_CTX(parser->ts);
 
        while (buffer->used || !php_http_message_parser_states[php_http_message_parser_state_is(parser)].need_data) {
 #if DBG_PARSER
 
        while (buffer->used || !php_http_message_parser_states[php_http_message_parser_state_is(parser)].need_data) {
 #if DBG_PARSER
@@ -250,24 +247,23 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
 
                        case PHP_HTTP_MESSAGE_PARSER_STATE_HEADER_DONE:
                        {
 
                        case PHP_HTTP_MESSAGE_PARSER_STATE_HEADER_DONE:
                        {
-                               zval *h, *h_loc = NULL, *h_con = NULL, **h_cl = NULL, **h_cr = NULL, **h_te = NULL;
+                               zval h, *h_loc = NULL, *h_con = NULL, *h_cl, *h_cr, *h_te, *h_ce;
 
 
-                               if ((h = php_http_message_header(*message, ZEND_STRL("Transfer-Encoding"), 1))) {
-                                       zend_hash_update(&(*message)->hdrs, "X-Original-Transfer-Encoding", sizeof("X-Original-Transfer-Encoding"), &h, sizeof(zval *), (void *) &h_te);
-                                       zend_hash_del(&(*message)->hdrs, "Transfer-Encoding", sizeof("Transfer-Encoding"));
+                               if ((h_te = php_http_message_header(*message, ZEND_STRL("Transfer-Encoding"), 1))) {
+                                       zend_hash_str_update(&(*message)->hdrs, "X-Original-Transfer-Encoding", lenof("X-Original-Transfer-Encoding"), h_te);
+                                       zend_hash_str_del(&(*message)->hdrs, "Transfer-Encoding", lenof("Transfer-Encoding"));
                                }
                                }
-                               if ((h = php_http_message_header(*message, ZEND_STRL("Content-Length"), 1))) {
-                                       zend_hash_update(&(*message)->hdrs, "X-Original-Content-Length", sizeof("X-Original-Content-Length"), &h, sizeof(zval *), (void *) &h_cl);
+                               if ((h_cl = php_http_message_header(*message, ZEND_STRL("Content-Length"), 1))) {
+                                       zend_hash_str_update(&(*message)->hdrs, "X-Original-Content-Length", lenof("X-Original-Content-Length"), h_cl);
                                }
                                }
-                               if ((h = php_http_message_header(*message, ZEND_STRL("Content-Range"), 1))) {
-                                       zend_hash_update(&(*message)->hdrs, "X-Original-Content-Range", sizeof("X-Original-Content-Range"), &h, sizeof(zval *), (void *) &h_cr);
-                                       zend_hash_del(&(*message)->hdrs, "Content-Range", sizeof("Content-Range"));
+                               if ((h_cr = php_http_message_header(*message, ZEND_STRL("Content-Range"), 1))) {
+                                       zend_hash_str_update(&(*message)->hdrs, "X-Original-Content-Range", sizeof("X-Original-Content-Range"), h_cr);
+                                       zend_hash_str_del(&(*message)->hdrs, "Content-Range", lenof("Content-Range"));
                                }
 
                                /* default */
                                }
 
                                /* default */
-                               MAKE_STD_ZVAL(h);
-                               ZVAL_LONG(h, 0);
-                               zend_hash_update(&(*message)->hdrs, "Content-Length", sizeof("Content-Length"), &h, sizeof(zval *), NULL);
+                               ZVAL_LONG(&h, 0);
+                               zend_hash_str_update(&(*message)->hdrs, "Content-Length", lenof("Content-Length"), &h);
 
                                /* so, if curl sees a 3xx code, a Location header and a Connection:close header
                                 * it decides not to read the response body.
 
                                /* so, if curl sees a 3xx code, a Location header and a Connection:close header
                                 * it decides not to read the response body.
@@ -280,32 +276,32 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                                ) {
                                        if (php_http_match(Z_STRVAL_P(h_con), "close", PHP_HTTP_MATCH_WORD)) {
                                                php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_DONE);
                                ) {
                                        if (php_http_match(Z_STRVAL_P(h_con), "close", PHP_HTTP_MATCH_WORD)) {
                                                php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_DONE);
-                                               zval_ptr_dtor(&h_loc);
-                                               zval_ptr_dtor(&h_con);
+                                               zval_ptr_dtor(h_loc);
+                                               zval_ptr_dtor(h_con);
                                                break;
                                        }
                                }
                                if (h_loc) {
                                                break;
                                        }
                                }
                                if (h_loc) {
-                                       zval_ptr_dtor(&h_loc);
+                                       zval_ptr_dtor(h_loc);
                                }
                                if (h_con) {
                                }
                                if (h_con) {
-                                       zval_ptr_dtor(&h_con);
+                                       zval_ptr_dtor(h_con);
                                }
 
                                }
 
-                               if ((h = php_http_message_header(*message, ZEND_STRL("Content-Encoding"), 1))) {
-                                       if (php_http_match(Z_STRVAL_P(h), "gzip", PHP_HTTP_MATCH_WORD)
-                                       ||      php_http_match(Z_STRVAL_P(h), "x-gzip", PHP_HTTP_MATCH_WORD)
-                                       ||      php_http_match(Z_STRVAL_P(h), "deflate", PHP_HTTP_MATCH_WORD)
+                               if ((h_ce = php_http_message_header(*message, ZEND_STRL("Content-Encoding"), 1))) {
+                                       if (php_http_match(Z_STRVAL_P(h_ce), "gzip", PHP_HTTP_MATCH_WORD)
+                                       ||      php_http_match(Z_STRVAL_P(h_ce), "x-gzip", PHP_HTTP_MATCH_WORD)
+                                       ||      php_http_match(Z_STRVAL_P(h_ce), "deflate", PHP_HTTP_MATCH_WORD)
                                        ) {
                                                if (parser->inflate) {
                                                        php_http_encoding_stream_reset(&parser->inflate);
                                                } else {
                                        ) {
                                                if (parser->inflate) {
                                                        php_http_encoding_stream_reset(&parser->inflate);
                                                } else {
-                                                       parser->inflate = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_inflate_ops(), 0 TSRMLS_CC);
+                                                       parser->inflate = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_inflate_ops(), 0);
                                                }
                                                }
-                                               zend_hash_update(&(*message)->hdrs, "X-Original-Content-Encoding", sizeof("X-Original-Content-Encoding"), &h, sizeof(zval *), NULL);
-                                               zend_hash_del(&(*message)->hdrs, "Content-Encoding", sizeof("Content-Encoding"));
+                                               zend_hash_str_update(&(*message)->hdrs, "X-Original-Content-Encoding", lenof("X-Original-Content-Encoding"), h_ce);
+                                               zend_hash_str_del(&(*message)->hdrs, "Content-Encoding", lenof("Content-Encoding"));
                                        } else {
                                        } else {
-                                               zval_ptr_dtor(&h);
+                                               zval_ptr_dtor(h_ce);
                                        }
                                }
 
                                        }
                                }
 
@@ -313,8 +309,8 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                                        php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DUMB);
                                } else {
                                        if (h_te) {
                                        php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DUMB);
                                } else {
                                        if (h_te) {
-                                               if (strstr(Z_STRVAL_PP(h_te), "chunked")) {
-                                                       parser->dechunk = php_http_encoding_stream_init(parser->dechunk, php_http_encoding_stream_get_dechunk_ops(), 0 TSRMLS_CC);
+                                               if (strstr(Z_STRVAL_P(h_te), "chunked")) {
+                                                       parser->dechunk = php_http_encoding_stream_init(parser->dechunk, php_http_encoding_stream_get_dechunk_ops(), 0);
                                                        php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_BODY_CHUNKED);
                                                        break;
                                                }
                                                        php_http_message_parser_state_push(parser, 1, PHP_HTTP_MESSAGE_PARSER_STATE_BODY_CHUNKED);
                                                        break;
                                                }
@@ -323,15 +319,15 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                                        if (h_cl) {
                                                char *stop;
 
                                        if (h_cl) {
                                                char *stop;
 
-                                               if (Z_TYPE_PP(h_cl) == IS_STRING) {
-                                                       parser->body_length = strtoul(Z_STRVAL_PP(h_cl), &stop, 10);
+                                               if (Z_TYPE_P(h_cl) == IS_STRING) {
+                                                       parser->body_length = strtoul(Z_STRVAL_P(h_cl), &stop, 10);
 
 
-                                                       if (stop != Z_STRVAL_PP(h_cl)) {
+                                                       if (stop != Z_STRVAL_P(h_cl)) {
                                                                php_http_message_parser_state_push(parser, 1, !parser->body_length?PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE:PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH);
                                                                break;
                                                        }
                                                                php_http_message_parser_state_push(parser, 1, !parser->body_length?PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE:PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH);
                                                                break;
                                                        }
-                                               } else if (Z_TYPE_PP(h_cl) == IS_LONG) {
-                                                       parser->body_length = Z_LVAL_PP(h_cl);
+                                               } else if (Z_TYPE_P(h_cl) == IS_LONG) {
+                                                       parser->body_length = Z_LVAL_P(h_cl);
                                                        php_http_message_parser_state_push(parser, 1, !parser->body_length?PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE:PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH);
                                                        break;
                                                }
                                                        php_http_message_parser_state_push(parser, 1, !parser->body_length?PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE:PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH);
                                                        break;
                                                }
@@ -340,14 +336,14 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                                        if (h_cr) {
                                                ulong total = 0, start = 0, end = 0;
 
                                        if (h_cr) {
                                                ulong total = 0, start = 0, end = 0;
 
-                                               if (!strncasecmp(Z_STRVAL_PP(h_cr), "bytes", lenof("bytes"))
-                                               && (    Z_STRVAL_P(h)[lenof("bytes")] == ':'
-                                                       ||      Z_STRVAL_P(h)[lenof("bytes")] == ' '
-                                                       ||      Z_STRVAL_P(h)[lenof("bytes")] == '='
+                                               if (!strncasecmp(Z_STRVAL_P(h_cr), "bytes", lenof("bytes"))
+                                               && (    Z_STRVAL_P(h_cr)[lenof("bytes")] == ':'
+                                                       ||      Z_STRVAL_P(h_cr)[lenof("bytes")] == ' '
+                                                       ||      Z_STRVAL_P(h_cr)[lenof("bytes")] == '='
                                                        )
                                                ) {
                                                        char *total_at = NULL, *end_at = NULL;
                                                        )
                                                ) {
                                                        char *total_at = NULL, *end_at = NULL;
-                                                       char *start_at = Z_STRVAL_PP(h_cr) + sizeof("bytes");
+                                                       char *start_at = Z_STRVAL_P(h_cr) + sizeof("bytes");
 
                                                        start = strtoul(start_at, &end_at, 10);
                                                        if (end_at) {
 
                                                        start = strtoul(start_at, &end_at, 10);
                                                        if (end_at) {
@@ -378,7 +374,7 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                        case PHP_HTTP_MESSAGE_PARSER_STATE_BODY:
                        {
                                if (len) {
                        case PHP_HTTP_MESSAGE_PARSER_STATE_BODY:
                        {
                                if (len) {
-                                       zval *zcl;
+                                       zval zcl;
 
                                        if (parser->inflate) {
                                                char *dec_str = NULL;
 
                                        if (parser->inflate) {
                                                char *dec_str = NULL;
@@ -398,9 +394,8 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
                                        php_stream_write(php_http_message_body_stream((*message)->body), str, len);
 
                                        /* keep track */
                                        php_stream_write(php_http_message_body_stream((*message)->body), str, len);
 
                                        /* keep track */
-                                       MAKE_STD_ZVAL(zcl);
-                                       ZVAL_LONG(zcl, php_http_message_body_size((*message)->body));
-                                       zend_hash_update(&(*message)->hdrs, "Content-Length", sizeof("Content-Length"), &zcl, sizeof(zval *), NULL);
+                                       ZVAL_LONG(&zcl, php_http_message_body_size((*message)->body));
+                                       zend_hash_str_update(&(*message)->hdrs, "Content-Length", lenof("Content-Length"), &zcl);
                                }
 
                                if (cut) {
                                }
 
                                if (cut) {
@@ -516,55 +511,46 @@ php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_p
 zend_class_entry *php_http_message_parser_class_entry;
 static zend_object_handlers php_http_message_parser_object_handlers;
 
 zend_class_entry *php_http_message_parser_class_entry;
 static zend_object_handlers php_http_message_parser_object_handlers;
 
-zend_object_value php_http_message_parser_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_message_parser_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_message_parser_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_message_parser_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_message_parser_object_new_ex(zend_class_entry *ce, php_http_message_parser_t *parser, php_http_message_parser_object_t **ptr TSRMLS_DC)
+php_http_message_parser_object_t *php_http_message_parser_object_new_ex(zend_class_entry *ce, php_http_message_parser_t *parser)
 {
        php_http_message_parser_object_t *o;
 
 {
        php_http_message_parser_object_t *o;
 
-       o = ecalloc(1, sizeof(php_http_message_parser_object_t));
-       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
-
-       if (ptr) {
-               *ptr = o;
-       }
+       o = ecalloc(1, sizeof(php_http_message_parser_object_t) + (ce->default_properties_count - 1) * sizeof(zval));
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
 
        if (parser) {
                o->parser = parser;
        } else {
 
        if (parser) {
                o->parser = parser;
        } else {
-               o->parser = php_http_message_parser_init(NULL TSRMLS_CC);
+               o->parser = php_http_message_parser_init(NULL);
        }
        }
-       o->buffer = php_http_buffer_new();
+       php_http_buffer_init(&o->buffer);
+       o->zo.handlers = &php_http_message_parser_object_handlers;
 
 
-       o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_parser_object_free, NULL TSRMLS_CC);
-       o->zv.handlers = &php_http_message_parser_object_handlers;
-
-       return o->zv;
+       return o;
 }
 
 }
 
-void php_http_message_parser_object_free(void *object TSRMLS_DC)
+void php_http_message_parser_object_free(zend_object *object)
 {
 {
-       php_http_message_parser_object_t *o = (php_http_message_parser_object_t *) object;
+       php_http_message_parser_object_t *o = PHP_HTTP_OBJ(object, NULL);
 
        if (o->parser) {
                php_http_message_parser_free(&o->parser);
        }
 
        if (o->parser) {
                php_http_message_parser_free(&o->parser);
        }
-       if (o->buffer) {
-               php_http_buffer_free(&o->buffer);
-       }
-       zend_object_std_dtor((zend_object *) o TSRMLS_CC);
-       efree(o);
+       php_http_buffer_dtor(&o->buffer);
+       zend_object_std_dtor(object);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageParser_getState, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessageParser, getState)
 {
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageParser_getState, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpMessageParser, getState)
 {
-       php_http_message_parser_object_t *parser_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
+       php_http_message_parser_object_t *parser_obj = PHP_HTTP_OBJ(NULL, getThis());
 
        zend_parse_parameters_none();
        /* always return the real state */
 
        zend_parse_parameters_none();
        /* always return the real state */
@@ -581,18 +567,20 @@ static PHP_METHOD(HttpMessageParser, parse)
        php_http_message_parser_object_t *parser_obj;
        zval *zmsg;
        char *data_str;
        php_http_message_parser_object_t *parser_obj;
        zval *zmsg;
        char *data_str;
-       int data_len;
-       long flags;
+       size_t data_len;
+       zend_long flags;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
 
-       parser_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-       php_http_buffer_append(parser_obj->buffer, data_str, data_len);
-       RETVAL_LONG(php_http_message_parser_parse(parser_obj->parser, parser_obj->buffer, flags, &parser_obj->parser->message));
+       parser_obj = PHP_HTTP_OBJ(NULL, getThis());
+       php_http_buffer_append(&parser_obj->buffer, data_str, data_len);
+       RETVAL_LONG(php_http_message_parser_parse(parser_obj->parser, &parser_obj->buffer, flags, &parser_obj->parser->message));
 
        zval_dtor(zmsg);
        if (parser_obj->parser->message) {
 
        zval_dtor(zmsg);
        if (parser_obj->parser->message) {
-               ZVAL_OBJVAL(zmsg, php_http_message_object_new_ex(php_http_message_class_entry, php_http_message_copy(parser_obj->parser->message, NULL), NULL TSRMLS_CC), 0);
+               php_http_message_t *msg_cpy = php_http_message_copy(parser_obj->parser->message, NULL);
+               php_http_message_object_t *msg_obj = php_http_message_object_new_ex(php_http_message_class_entry, msg_cpy);
+               ZVAL_OBJ(zmsg, &msg_obj->zo);
        }
 }
 
        }
 }
 
@@ -607,20 +595,22 @@ static PHP_METHOD(HttpMessageParser, stream)
        zend_error_handling zeh;
        zval *zmsg, *zstream;
        php_stream *s;
        zend_error_handling zeh;
        zval *zmsg, *zstream;
        php_stream *s;
-       long flags;
+       zend_long flags;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh TSRMLS_CC);
-       php_stream_from_zval(s, &zstream);
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh);
+       php_stream_from_zval(s, zstream);
+       zend_restore_error_handling(&zeh);
 
 
-       parser_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
-       RETVAL_LONG(php_http_message_parser_parse_stream(parser_obj->parser, parser_obj->buffer, s, flags, &parser_obj->parser->message));
+       parser_obj = PHP_HTTP_OBJ(NULL, getThis());
+       RETVAL_LONG(php_http_message_parser_parse_stream(parser_obj->parser, &parser_obj->buffer, s, flags, &parser_obj->parser->message));
 
        zval_dtor(zmsg);
        if (parser_obj->parser->message) {
 
        zval_dtor(zmsg);
        if (parser_obj->parser->message) {
-               ZVAL_OBJVAL(zmsg, php_http_message_object_new_ex(php_http_message_class_entry, php_http_message_copy(parser_obj->parser->message, NULL), NULL TSRMLS_CC), 0);
+               php_http_message_t *msg_cpy = php_http_message_copy(parser_obj->parser->message, NULL);
+               php_http_message_object_t *msg_obj = php_http_message_object_new_ex(php_http_message_class_entry, msg_cpy);
+               ZVAL_OBJ(zmsg, &msg_obj->zo);
        }
 }
 
        }
 }
 
@@ -636,26 +626,28 @@ PHP_MINIT_FUNCTION(http_message_parser)
        zend_class_entry ce;
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Message", "Parser", php_http_message_parser_methods);
        zend_class_entry ce;
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Message", "Parser", php_http_message_parser_methods);
-       php_http_message_parser_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_message_parser_class_entry = zend_register_internal_class(&ce);
        memcpy(&php_http_message_parser_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_message_parser_class_entry->create_object = php_http_message_parser_object_new;
        php_http_message_parser_object_handlers.clone_obj = NULL;
        memcpy(&php_http_message_parser_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_message_parser_class_entry->create_object = php_http_message_parser_object_new;
        php_http_message_parser_object_handlers.clone_obj = NULL;
-
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("CLEANUP"), PHP_HTTP_MESSAGE_PARSER_CLEANUP TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("DUMB_BODIES"), PHP_HTTP_MESSAGE_PARSER_DUMB_BODIES TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("EMPTY_REDIRECTS"), PHP_HTTP_MESSAGE_PARSER_EMPTY_REDIRECTS TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("GREEDY"), PHP_HTTP_MESSAGE_PARSER_GREEDY TSRMLS_CC);
-
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_FAILURE"), PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_START"), PHP_HTTP_MESSAGE_PARSER_STATE_START TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_HEADER"), PHP_HTTP_MESSAGE_PARSER_STATE_HEADER TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_HEADER_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_HEADER_DONE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_DUMB"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DUMB TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_LENGTH"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_CHUNKED"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_CHUNKED TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_DONE TSRMLS_CC);
+       php_http_message_parser_object_handlers.dtor_obj = php_http_message_parser_object_free;
+       php_http_message_parser_object_handlers.offset = XtOffsetOf(php_http_message_parser_object_t, zo);
+
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("CLEANUP"), PHP_HTTP_MESSAGE_PARSER_CLEANUP);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("DUMB_BODIES"), PHP_HTTP_MESSAGE_PARSER_DUMB_BODIES);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("EMPTY_REDIRECTS"), PHP_HTTP_MESSAGE_PARSER_EMPTY_REDIRECTS);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("GREEDY"), PHP_HTTP_MESSAGE_PARSER_GREEDY);
+
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_FAILURE"), PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_START"), PHP_HTTP_MESSAGE_PARSER_STATE_START);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_HEADER"), PHP_HTTP_MESSAGE_PARSER_STATE_HEADER);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_HEADER_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_HEADER_DONE);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_DUMB"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DUMB);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_LENGTH"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_LENGTH);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_CHUNKED"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_CHUNKED);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_BODY_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_BODY_DONE);
+       zend_declare_class_constant_long(php_http_message_parser_class_entry, ZEND_STRL("STATE_DONE"), PHP_HTTP_MESSAGE_PARSER_STATE_DONE);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index c2bee1544713ac84c031ff9b2fd9a9bccd9c1352..71d91f066c964010013f0b671ef57a04042ac83d 100644 (file)
@@ -42,12 +42,9 @@ typedef struct php_http_message_parser {
        php_http_message_t *message;
        php_http_encoding_stream_t *dechunk;
        php_http_encoding_stream_t *inflate;
        php_http_message_t *message;
        php_http_encoding_stream_t *dechunk;
        php_http_encoding_stream_t *inflate;
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_message_parser_t;
 
 } php_http_message_parser_t;
 
-PHP_HTTP_API php_http_message_parser_t *php_http_message_parser_init(php_http_message_parser_t *parser TSRMLS_DC);
+PHP_HTTP_API php_http_message_parser_t *php_http_message_parser_init(php_http_message_parser_t *parser);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_push(php_http_message_parser_t *parser, unsigned argc, ...);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_is(php_http_message_parser_t *parser);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_pop(php_http_message_parser_t *parser);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_push(php_http_message_parser_t *parser, unsigned argc, ...);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_is(php_http_message_parser_t *parser);
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_state_pop(php_http_message_parser_t *parser);
@@ -57,19 +54,18 @@ PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse(php_h
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse_stream(php_http_message_parser_t *parser, php_http_buffer_t *buffer, php_stream *s, unsigned flags, php_http_message_t **message);
 
 typedef struct php_http_message_parser_object {
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse_stream(php_http_message_parser_t *parser, php_http_buffer_t *buffer, php_stream *s, unsigned flags, php_http_message_t **message);
 
 typedef struct php_http_message_parser_object {
-       zend_object zo;
-       zend_object_value zv;
-       php_http_buffer_t *buffer;
+       php_http_buffer_t buffer;
        php_http_message_parser_t *parser;
        php_http_message_parser_t *parser;
+       zend_object zo;
 } php_http_message_parser_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_parser_class_entry;
 
 PHP_MINIT_FUNCTION(http_message_parser);
 
 } php_http_message_parser_object_t;
 
 PHP_HTTP_API zend_class_entry *php_http_message_parser_class_entry;
 
 PHP_MINIT_FUNCTION(http_message_parser);
 
-zend_object_value php_http_message_parser_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_message_parser_object_new_ex(zend_class_entry *ce, php_http_message_parser_t *parser, php_http_message_parser_object_t **ptr TSRMLS_DC);
-void php_http_message_parser_object_free(void *object TSRMLS_DC);
+zend_object *php_http_message_parser_object_new(zend_class_entry *ce);
+php_http_message_parser_object_t *php_http_message_parser_object_new_ex(zend_class_entry *ce, php_http_message_parser_t *parser);
+void php_http_message_parser_object_free(zend_object *object);
 
 #endif
 
 
 #endif
 
index c6e22700fdafeda8ada5baf65ec2eb74fa181095..ff0c02475d204075ef18547792d50de54cd5ee9e 100644 (file)
@@ -144,69 +144,64 @@ int php_http_select_str(const char *cmp, int argc, ...)
 
 /* ARRAYS */
 
 
 /* ARRAYS */
 
-unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...)
+unsigned php_http_array_list(HashTable *ht, unsigned argc, ...)
 {
 {
-       HashPosition pos;
        unsigned argl = 0;
        va_list argv;
        unsigned argl = 0;
        va_list argv;
+       zval *data;
 
        va_start(argv, argc);
 
        va_start(argv, argc);
-       for (   zend_hash_internal_pointer_reset_ex(ht, &pos);
-                       SUCCESS == zend_hash_has_more_elements_ex(ht, &pos) && (argl < argc);
-                       zend_hash_move_forward_ex(ht, &pos))
-       {
-               zval **data, ***argp = (zval ***) va_arg(argv, zval ***);
-
-               if (SUCCESS == zend_hash_get_current_data_ex(ht, (void *) &data, &pos)) {
-                       *argp = data;
-                       ++argl;
-               }
-       }
+       ZEND_HASH_FOREACH_VAL(ht, data) {
+               zval **argp = (zval **) va_arg(argv, zval **);
+               *argp = data;
+               ++argl;
+       } ZEND_HASH_FOREACH_END();
        va_end(argv);
 
        return argl;
 }
 
        va_end(argv);
 
        return argl;
 }
 
-void php_http_array_copy_strings(void *zpp)
+void php_http_array_copy_strings(zval *zp)
 {
 {
-       zval **zvpp = ((zval **) zpp);
-
-       *zvpp = php_http_zsep(1, IS_STRING, *zvpp);
+       convert_to_string_ex(zp);
 }
 
 }
 
-int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+int php_http_array_apply_append_func(zval *value, int num_args, va_list args, zend_hash_key *hash_key)
 {
        int flags;
        char *key = NULL;
        HashTable *dst;
 {
        int flags;
        char *key = NULL;
        HashTable *dst;
-       zval **data = NULL, *value = *((zval **) pDest);
+       zval *data = NULL;
 
        dst = va_arg(args, HashTable *);
        flags = va_arg(args, int);
 
 
        dst = va_arg(args, HashTable *);
        flags = va_arg(args, int);
 
-       if ((!(flags & ARRAY_JOIN_STRONLY)) || hash_key->nKeyLength) {
-               if ((flags & ARRAY_JOIN_PRETTIFY) && hash_key->nKeyLength) {
-                       key = php_http_pretty_key(estrndup(hash_key->arKey, hash_key->nKeyLength - 1), hash_key->nKeyLength - 1, 1, 1);
-                       zend_hash_find(dst, key, hash_key->nKeyLength, (void *) &data);
+       if ((!(flags & ARRAY_JOIN_STRONLY)) || hash_key->key) {
+               if ((flags & ARRAY_JOIN_PRETTIFY) && hash_key->key) {
+                       key = php_http_pretty_key(estrndup(hash_key->key->val, hash_key->key->len), hash_key->key->len, 1, 1);
+                       data = zend_hash_str_find(dst, key, hash_key->key->len);
+               } else if (hash_key->key) {
+                       data = zend_hash_find(dst, hash_key->key);
                } else {
                } else {
-                       zend_hash_quick_find(dst, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void *) &data);
+                       data = zend_hash_index_find(dst, hash_key->h);
                }
 
                if (flags & ARRAY_JOIN_STRINGIFY) {
                }
 
                if (flags & ARRAY_JOIN_STRINGIFY) {
-                       value = php_http_zsep(1, IS_STRING, value);
-               } else {
-                       Z_ADDREF_P(value);
+                       convert_to_string_ex(value);
                }
                }
+               Z_ADDREF_P(value);
 
                if (data) {
 
                if (data) {
-                       if (Z_TYPE_PP(data) != IS_ARRAY) {
-                               convert_to_array(*data);
+                       if (Z_TYPE_P(data) != IS_ARRAY) {
+                               convert_to_array(data);
                        }
                        }
-                       add_next_index_zval(*data, value);
+                       add_next_index_zval(data, value);
                } else if (key) {
                } else if (key) {
-                       zend_symtable_update(dst, key, hash_key->nKeyLength, &value, sizeof(zval *), NULL);
+                       zend_hash_str_update(dst, key, hash_key->key->len, value);
+               } else if (hash_key->key) {
+                       zend_hash_update(dst, hash_key->key, value);
                } else {
                } else {
-                       zend_hash_quick_add(dst, hash_key->arKey, hash_key->nKeyLength, hash_key->h, &value, sizeof(zval *), NULL);
+                       zend_hash_index_update(dst, hash_key->h, value);
                }
 
                if (key) {
                }
 
                if (key) {
@@ -217,29 +212,30 @@ int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_lis
        return ZEND_HASH_APPLY_KEEP;
 }
 
        return ZEND_HASH_APPLY_KEEP;
 }
 
-int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+int php_http_array_apply_merge_func(zval *value, int num_args, va_list args, zend_hash_key *hash_key)
 {
        int flags;
        char *key = NULL;
        HashTable *dst;
 {
        int flags;
        char *key = NULL;
        HashTable *dst;
-       zval *value = *((zval **) pDest);
 
        dst = va_arg(args, HashTable *);
        flags = va_arg(args, int);
 
 
        dst = va_arg(args, HashTable *);
        flags = va_arg(args, int);
 
-       if ((!(flags & ARRAY_JOIN_STRONLY)) || hash_key->nKeyLength) {
+       if ((!(flags & ARRAY_JOIN_STRONLY)) || hash_key->key) {
                if (flags & ARRAY_JOIN_STRINGIFY) {
                if (flags & ARRAY_JOIN_STRINGIFY) {
-                       value = php_http_zsep(1, IS_STRING, value);
-               } else {
-                       Z_ADDREF_P(value);
+                       convert_to_string_ex(value);
                }
 
                }
 
-               if ((flags & ARRAY_JOIN_PRETTIFY) && hash_key->nKeyLength) {
-                       key = php_http_pretty_key(estrndup(hash_key->arKey, hash_key->nKeyLength - 1), hash_key->nKeyLength - 1, 1, 1);
-                       zend_hash_update(dst, key, hash_key->nKeyLength, (void *) &value, sizeof(zval *), NULL);
+               Z_ADDREF_P(value);
+
+               if ((flags & ARRAY_JOIN_PRETTIFY) && hash_key->key) {
+                       key = php_http_pretty_key(estrndup(hash_key->key->val, hash_key->key->len), hash_key->key->len, 1, 1);
+                       zend_hash_str_update(dst, key, hash_key->key->len, value);
                        efree(key);
                        efree(key);
+               } else if (hash_key->key) {
+                       zend_hash_update(dst, hash_key->key, value);
                } else {
                } else {
-                       zend_hash_quick_update(dst, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void *) &value, sizeof(zval *), NULL);
+                       zend_hash_index_update(dst, hash_key->h, value);
                }
        }
 
                }
        }
 
@@ -251,11 +247,9 @@ int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list
 size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len)
 {
        php_http_pass_fcall_arg_t *fcd = cb_arg;
 size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len)
 {
        php_http_pass_fcall_arg_t *fcd = cb_arg;
-       zval *zdata;
-       TSRMLS_FETCH_FROM_CTX(fcd->ts);
+       zval zdata;
 
 
-       MAKE_STD_ZVAL(zdata);
-       ZVAL_STRINGL(zdata, str, len, 1);
+       ZVAL_STRINGL(&zdata, str, len);
        if (SUCCESS == zend_fcall_info_argn(&fcd->fci TSRMLS_CC, 2, &fcd->fcz, &zdata)) {
                zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL TSRMLS_CC);
                zend_fcall_info_args_clear(&fcd->fci, 0);
        if (SUCCESS == zend_fcall_info_argn(&fcd->fci TSRMLS_CC, 2, &fcd->fcz, &zdata)) {
                zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL TSRMLS_CC);
                zend_fcall_info_args_clear(&fcd->fci, 0);
index 8e901da3c135e546ebb8f7b6bb239be6756c8a92..1a74c34d8262b88c5543289707627d586214c9eb 100644 (file)
@@ -61,7 +61,7 @@ PHP_HTTP_API void php_http_sleep(double s);
 
 int php_http_match(const char *haystack, const char *needle, int flags);
 char *php_http_pretty_key(register char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen);
 
 int php_http_match(const char *haystack, const char *needle, int flags);
 char *php_http_pretty_key(register char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen);
-size_t php_http_boundary(char *buf, size_t len TSRMLS_DC);
+size_t php_http_boundary(char *buf, size_t len);
 int php_http_select_str(const char *cmp, int argc, ...);
 
 /* See "A Reusable Duff Device" By Ralf Holly, August 01, 2005 */
 int php_http_select_str(const char *cmp, int argc, ...);
 
 /* See "A Reusable Duff Device" By Ralf Holly, August 01, 2005 */
@@ -136,126 +136,63 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i
 
 /* ZEND */
 
 
 /* ZEND */
 
-#if PHP_VERSION_ID < 50400
-#      define object_properties_init(o, ce) zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*))
-#      define PHP_HTTP_ZEND_LITERAL_DC 
-#      define PHP_HTTP_ZEND_LITERAL_CC
-#      define PHP_HTTP_ZEND_LITERAL_CCN
-#      define ZVAL_COPY_VALUE(zv, arr) do { \
-               (zv)->value = (arr)->value; \
-               Z_TYPE_P(zv) = Z_TYPE_P(arr); \
-       } while (0)
-#else
-#      define PHP_HTTP_ZEND_LITERAL_DC , const zend_literal *literal_key
-#      define PHP_HTTP_ZEND_LITERAL_CC , (literal_key)
-#      define PHP_HTTP_ZEND_LITERAL_CCN , NULL
-#endif
-
-#if PHP_VERSION_ID < 50700
-#      define z_is_true zend_is_true
-#else
-#      define z_is_true(z) zend_is_true(z TSRMLS_CC)
-#endif
-
-#define INIT_PZVAL_ARRAY(zv, ht) \
-       { \
-               INIT_PZVAL((zv)); \
-               Z_TYPE_P(zv) = IS_ARRAY; \
-               Z_ARRVAL_P(zv) = (ht); \
-       }
-
-static inline zval *php_http_zconv(int type, zval *z)
+static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv)
 {
 {
-       switch (type) {
-               case IS_NULL:   convert_to_null_ex(&z);         break;
-               case IS_BOOL:   convert_to_boolean_ex(&z);      break;
-               case IS_LONG:   convert_to_long_ex(&z);         break;
-               case IS_DOUBLE: convert_to_double_ex(&z);       break;
-               case IS_STRING: convert_to_string_ex(&z);       break;
-               case IS_ARRAY:  convert_to_array_ex(&z);        break;
-               case IS_OBJECT: convert_to_object_ex(&z);       break;
+       if (!zo) {
+               zo = Z_OBJ_P(zv);
        }
        }
-       return z;
+       return (char *) zo - zo->handlers->offset;
 }
 
 }
 
-static inline zval *php_http_ztyp(int type, zval *z)
+static inline zend_string *php_http_cs2zs(char *s, size_t l)
 {
 {
-       SEPARATE_ARG_IF_REF(z);
-       return (Z_TYPE_P(z) == type) ? z : php_http_zconv(type, z);
-}
+       zend_string *str = erealloc(s, sizeof(*str) + l);
 
 
-static inline zval *php_http_zsep(zend_bool add_ref, int type, zval *z)
-{
-       if (add_ref) {
-               Z_ADDREF_P(z);
-       }
-       if (Z_TYPE_P(z) != type) {
-               return php_http_zconv(type, z);
-       } else {
-               SEPARATE_ZVAL_IF_NOT_REF(&z);
-               return z;
-       }
+       memmove(str->val, str, l);
+       str->val[l] = 0;
+       str->len = l;
+       str->h = 0;
+
+       GC_REFCOUNT(str) = 1;
+       GC_TYPE_INFO(str) = IS_STRING;
+
+       return str;
 }
 
 }
 
-static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, const char **value_str, size_t *value_len, zend_bool orig TSRMLS_DC)
+static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t name_len, const char **val_str, size_t *val_len, zend_bool orig)
 {
        zend_ini_entry *ini_entry;
 
 {
        zend_ini_entry *ini_entry;
 
-       if (SUCCESS == zend_hash_find(EG(ini_directives), name_str, name_len + 1, (void *) &ini_entry)) {
+       if (ini_entry == zend_hash_str_find_ptr(EG(ini_directives), name_str, name_len)) {
                if (orig && ini_entry->modified) {
                if (orig && ini_entry->modified) {
-                       *value_str = ini_entry->orig_value;
-                       *value_len = (size_t) ini_entry->orig_value_length;
+                       *val_str = ini_entry->orig_value->val;
+                       *val_len = ini_entry->orig_value->len;
                } else {
                } else {
-                       *value_str = ini_entry->value;
-                       *value_len = (size_t) ini_entry->value_length;
+                       *val_str = ini_entry->value->val;
+                       *val_len = ini_entry->value->len;
                }
                return SUCCESS;
        }
        return FAILURE;
 }
 
                }
                return SUCCESS;
        }
        return FAILURE;
 }
 
+#define RETVAL_STR_COPY(zs) ZVAL_STR_COPY(return_value, zs)
+#define RETURN_STR_COPY(zs) do { \
+       ZVAL_STR_COPY(return_value, zs); \
+       return; \
+}
+
 /* return object(values) */
 /* return object(values) */
+#define ZVAL_OBJECT(z, o, addref) \
+       ZVAL_OBJ(z, o); \
+       if (addref) { \
+               Z_ADDREF_P(z); \
+       }
 #define RETVAL_OBJECT(o, addref) \
 #define RETVAL_OBJECT(o, addref) \
-       RETVAL_OBJVAL((o)->value.obj, addref)
+       ZVAL_OBJECT(return_value, o, addref)
 #define RETURN_OBJECT(o, addref) \
        RETVAL_OBJECT(o, addref); \
        return
 #define RETURN_OBJECT(o, addref) \
        RETVAL_OBJECT(o, addref); \
        return
-#define RETVAL_OBJVAL(ov, addref) \
-       ZVAL_OBJVAL(return_value, ov, addref)
-#define RETURN_OBJVAL(ov, addref) \
-       RETVAL_OBJVAL(ov, addref); \
-       return
-#define ZVAL_OBJVAL(zv, ov, addref) \
-       (zv)->type = IS_OBJECT; \
-       (zv)->value.obj = (ov);\
-       if (addref && Z_OBJ_HT_P(zv)->add_ref) { \
-               Z_OBJ_HT_P(zv)->add_ref((zv) TSRMLS_CC); \
-       }
-
-#define Z_OBJ_DELREF(z) \
-       if (Z_OBJ_HT(z)->del_ref) { \
-               Z_OBJ_HT(z)->del_ref(&(z) TSRMLS_CC); \
-       }
-#define Z_OBJ_ADDREF(z) \
-       if (Z_OBJ_HT(z)->add_ref) { \
-               Z_OBJ_HT(z)->add_ref(&(z) TSRMLS_CC); \
-       }
-#define Z_OBJ_DELREF_P(z) \
-       if (Z_OBJ_HT_P(z)->del_ref) { \
-               Z_OBJ_HT_P(z)->del_ref((z) TSRMLS_CC); \
-       }
-#define Z_OBJ_ADDREF_P(z) \
-       if (Z_OBJ_HT_P(z)->add_ref) { \
-               Z_OBJ_HT_P(z)->add_ref((z) TSRMLS_CC); \
-       }
-#define Z_OBJ_DELREF_PP(z) \
-       if (Z_OBJ_HT_PP(z)->del_ref) { \
-               Z_OBJ_HT_PP(z)->del_ref(*(z) TSRMLS_CC); \
-       }
-#define Z_OBJ_ADDREF_PP(z) \
-       if (Z_OBJ_HT_PP(z)->add_ref) { \
-               Z_OBJ_HT_PP(z)->add_ref(*(z) TSRMLS_CC); \
-       }
 
 #define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
 
 
 #define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
 
@@ -266,64 +203,53 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c
 
 /* ARRAYS */
 
 
 /* ARRAYS */
 
-#ifndef HASH_KEY_NON_EXISTENT
-#      define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT
-#endif
-
-PHP_HTTP_API unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...);
+PHP_HTTP_API unsigned php_http_array_list(HashTable *ht, unsigned argc, ...);
 
 
-typedef struct php_http_array_hashkey {
-       char *str;
-       uint len;
-       ulong num;
-       uint dup:1;
-       uint type:31;
-} php_http_array_hashkey_t;
-#define php_http_array_hashkey_init(dup) {NULL, 0, 0, (dup), 0}
+typedef struct php_http_arrkey {
+       zend_ulong h;
+       zend_string *key;
+       unsigned allocated:1;
+       unsigned stringified:1;
+} php_http_arrkey_t;
 
 
-static inline void php_http_array_hashkey_stringify(php_http_array_hashkey_t *key)
+static inline void *php_http_arrkey_stringify(php_http_arrkey_t *arrkey, zend_hash_key *key)
 {
 {
-       if (key->type != HASH_KEY_IS_STRING) {
-               key->len = spprintf(&key->str, 0, "%lu", key->num) + 1;
+       if (arrkey) {
+               arrkey->allocated = 0;
+       } else {
+               arrkey = emalloc(sizeof(*arrkey));
+               arrkey->allocated = 1;
+       }
+
+       if (key) {
+               memcpy(&arrkey, key, sizeof(*key));
+       }
+       if ((arrkey->stringified = !arrkey->key)) {
+               arrkey->key = zend_long_to_str(arrkey->h);
        }
        }
+       return arrkey;
 }
 
 }
 
-static inline void php_http_array_hashkey_stringfree(php_http_array_hashkey_t *key)
+static inline void php_http_arrkey_dtor(php_http_arrkey_t *arrkey)
 {
 {
-       if (key->type != HASH_KEY_IS_STRING || key->dup) {
-               PTR_FREE(key->str);
+       if (arrkey->stringified) {
+               zend_string_release(arrkey->key);
+       }
+       if (arrkey->allocated) {
+               efree(arrkey);
        }
 }
 
        }
 }
 
-#define FOREACH_VAL(pos, array, val) FOREACH_HASH_VAL(pos, HASH_OF(array), val)
-#define FOREACH_HASH_VAL(pos, hash, val) \
-       for (   zend_hash_internal_pointer_reset_ex(hash, &pos); \
-                       zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \
-                       zend_hash_move_forward_ex(hash, &pos))
-
-#define FOREACH_KEY(pos, array, key) FOREACH_HASH_KEY(pos, HASH_OF(array), key)
-#define FOREACH_HASH_KEY(pos, hash, _key) \
-       for (   zend_hash_internal_pointer_reset_ex(hash, &pos); \
-                       ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT; \
-                       zend_hash_move_forward_ex(hash, &pos)) \
-
-#define FOREACH_KEYVAL(pos, array, key, val) FOREACH_HASH_KEYVAL(pos, HASH_OF(array), key, val)
-#define FOREACH_HASH_KEYVAL(pos, hash, _key, val) \
-       for (   zend_hash_internal_pointer_reset_ex(hash, &pos); \
-                       ((_key).type = zend_hash_get_current_key_ex(hash, &(_key).str, &(_key).len, &(_key).num, (zend_bool) (_key).dup, &pos)) != HASH_KEY_NON_EXISTANT && \
-                       zend_hash_get_current_data_ex(hash, (void *) &val, &pos) == SUCCESS; \
-                       zend_hash_move_forward_ex(hash, &pos))
-
-#define array_copy(src, dst) zend_hash_copy(dst, src, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *))
-#define array_copy_strings(src, dst) zend_hash_copy(dst, src, php_http_array_copy_strings, NULL, sizeof(zval *))
+#define array_copy(src, dst) zend_hash_copy(dst, src, (copy_ctor_func_t) zval_add_ref)
+#define array_copy_strings(src, dst) zend_hash_copy(dst, src, php_http_array_copy_strings)
 #define ARRAY_JOIN_STRONLY   0x01
 #define ARRAY_JOIN_PRETTIFY  0x02
 #define ARRAY_JOIN_STRINGIFY 0x04
 #define ARRAY_JOIN_STRONLY   0x01
 #define ARRAY_JOIN_PRETTIFY  0x02
 #define ARRAY_JOIN_STRINGIFY 0x04
-#define array_join(src, dst, append, flags) zend_hash_apply_with_arguments(src TSRMLS_CC, (append)?php_http_array_apply_append_func:php_http_array_apply_merge_func, 2, dst, (int)flags)
+#define array_join(src, dst, append, flags) zend_hash_apply_with_arguments(src, (append)?php_http_array_apply_append_func:php_http_array_apply_merge_func, 2, dst, (int)flags)
 
 
-void php_http_array_copy_strings(void *zpp);
-int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key);
-int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key);
+void php_http_array_copy_strings(zval *zp);
+int php_http_array_apply_append_func(zval *pDest, int num_args, va_list args, zend_hash_key *hash_key);
+int php_http_array_apply_merge_func(zval *pDest, int num_args, va_list args, zend_hash_key *hash_key);
 
 /* PASS CALLBACK */
 
 
 /* PASS CALLBACK */
 
@@ -332,12 +258,9 @@ typedef size_t (*php_http_pass_php_http_buffer_callback_t)(void *cb_arg, php_htt
 typedef size_t (*php_http_pass_format_callback_t)(void *cb_arg, const char *fmt, ...);
 
 typedef struct php_http_pass_fcall_arg {
 typedef size_t (*php_http_pass_format_callback_t)(void *cb_arg, const char *fmt, ...);
 
 typedef struct php_http_pass_fcall_arg {
-       zval *fcz;
+       zval fcz;
        zend_fcall_info fci;
        zend_fcall_info_cache fcc;
        zend_fcall_info fci;
        zend_fcall_info_cache fcc;
-#ifdef ZTS
-       void ***ts;
-#endif
 } php_http_pass_fcall_arg_t;
 
 PHP_HTTP_API size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len);
 } php_http_pass_fcall_arg_t;
 
 PHP_HTTP_API size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len);
index a74875b7378647664a1fe35a63b72c8f17995d79..5b9fe5f9bbc8b399667543296196a36d9e889769 100644 (file)
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-static int php_http_negotiate_sort(const void *a, const void *b TSRMLS_DC)
+static int php_http_negotiate_sort(const void *first, const void *second TSRMLS_DC)
 {
 {
-       zval result, *first, *second;
+       zval result;
+       Bucket *b1 = (Bucket *) first, *b2 = (Bucket *) second;
 
 
-       first = *((zval **) (*((Bucket **) a))->pData);
-       second= *((zval **) (*((Bucket **) b))->pData);
-
-       if (numeric_compare_function(&result, first, second TSRMLS_CC) != SUCCESS) {
+       if (numeric_compare_function(&result, &b1->val, &b2->val)!= SUCCESS) {
                return 0;
        }
        return (Z_LVAL(result) > 0 ? -1 : (Z_LVAL(result) < 0 ? 1 : 0));
                return 0;
        }
        return (Z_LVAL(result) > 0 ? -1 : (Z_LVAL(result) < 0 ? 1 : 0));
@@ -67,35 +65,37 @@ static inline unsigned php_http_negotiate_match(const char *param_str, size_t pa
 #endif
        return match;
 }
 #endif
        return match;
 }
-
-static int php_http_negotiate_reduce(void *p TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+static int php_http_negotiate_reduce(zval *p, int num_args, va_list args, zend_hash_key *hash_key)
 {
        unsigned best_match = 0;
 {
        unsigned best_match = 0;
-       HashPosition pos;
-       php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-       zval **q = NULL, **val, *supported = php_http_ztyp(IS_STRING, *(zval **)p);
+       php_http_arrkey_t key;
+       zval *value, *q = NULL;
+       zend_string *supported = zval_get_string(p);
        HashTable *params = va_arg(args, HashTable *);
        HashTable *result = va_arg(args, HashTable *);
        const char *sep_str = va_arg(args, const char *);
        size_t sep_len = va_arg(args, size_t);
 
        HashTable *params = va_arg(args, HashTable *);
        HashTable *result = va_arg(args, HashTable *);
        const char *sep_str = va_arg(args, const char *);
        size_t sep_len = va_arg(args, size_t);
 
-       FOREACH_HASH_KEYVAL(pos, params, key, val) {
-               if (key.type == HASH_KEY_IS_STRING) {
-                       unsigned match = php_http_negotiate_match(key.str, key.len-1, Z_STRVAL_P(supported), Z_STRLEN_P(supported), sep_str, sep_len);
+       ZEND_HASH_FOREACH_KEY_VAL(params, key.h, key.key, value)
+       {
+               unsigned match;
 
 
-                       if (match > best_match) {
-                               best_match = match;
-                               q = val;
-                       }
+               php_http_arrkey_stringify(&key, NULL);
+               match = php_http_negotiate_match(key.key->val, key.key->len, supported->val, supported->len, sep_str, sep_len);
+
+               if (match > best_match) {
+                       best_match = match;
+                       q = value;
                }
                }
+               php_http_arrkey_dtor(&key);
        }
        }
+       ZEND_HASH_FOREACH_END();
 
 
-       if (q && Z_DVAL_PP(q) > 0) {
-               Z_ADDREF_PP(q);
-               zend_hash_update(result, Z_STRVAL_P(supported), Z_STRLEN_P(supported) + 1, (void *) q, sizeof(zval *), NULL);
+       if (q && Z_DVAL_P(q) > 0) {
+               zend_hash_update(result, supported, q);
        }
 
        }
 
-       zval_ptr_dtor(&supported);
+       zend_string_release(supported);
        return ZEND_HASH_APPLY_KEEP;
 }
 
        return ZEND_HASH_APPLY_KEEP;
 }
 
@@ -105,10 +105,9 @@ HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable
 
        if (value_str && value_len) {
                unsigned i = 0;
 
        if (value_str && value_len) {
                unsigned i = 0;
-               zval arr, **val, **arg, **zq;
-               HashPosition pos;
+               zval arr, *val, *arg, *zq;
                HashTable params;
                HashTable params;
-               php_http_array_hashkey_t key = php_http_array_hashkey_init(1);
+               php_http_arrkey_t key;
                php_http_params_opts_t opts;
 
                zend_hash_init(&params, 10, NULL, ZVAL_PTR_DTOR, 0);
                php_http_params_opts_t opts;
 
                zend_hash_init(&params, 10, NULL, ZVAL_PTR_DTOR, 0);
@@ -118,42 +117,39 @@ HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable
                php_http_params_parse(&params, &opts TSRMLS_CC);
                efree(opts.input.str);
 
                php_http_params_parse(&params, &opts TSRMLS_CC);
                efree(opts.input.str);
 
-               INIT_PZVAL(&arr);
                array_init(&arr);
 
                array_init(&arr);
 
-               FOREACH_HASH_KEYVAL(pos, &params, key, val) {
+               ZEND_HASH_FOREACH_KEY_VAL(&params, key.h, key.key, val)
+               {
                        double q;
 
                        double q;
 
-                       if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(val), ZEND_STRS("arguments"), (void *) &arg)
-                       &&      IS_ARRAY == Z_TYPE_PP(arg)
-                       &&      SUCCESS == zend_hash_find(Z_ARRVAL_PP(arg), ZEND_STRS("q"), (void *) &zq)) {
-                               zval *tmp = php_http_ztyp(IS_DOUBLE, *zq);
-
-                               q = Z_DVAL_P(tmp);
-                               zval_ptr_dtor(&tmp);
+                       if ((arg = zend_hash_str_find(Z_ARRVAL_P(val), ZEND_STRL("arguments")))
+                       &&      (IS_ARRAY == Z_TYPE_P(arg))
+                       &&      (zq = zend_hash_str_find(Z_ARRVAL_P(arg), ZEND_STRL("q")))) {
+                               q = zval_get_double(zq);
                        } else {
                                q = 1.0 - ++i / 100.0;
                        }
 
                        } else {
                                q = 1.0 - ++i / 100.0;
                        }
 
-                       if (key.type == HASH_KEY_IS_STRING) {
-                               add_assoc_double_ex(&arr, key.str, key.len, q);
+                       if (key.key) {
+                               add_assoc_double_ex(&arr, key.key->val, key.key->len, q);
                        } else {
                        } else {
-                               add_index_double(&arr, key.num, q);
+                               add_index_double(&arr, key.h, q);
                        }
 
                        }
 
-                       PTR_FREE(key.str);
                }
                }
+               ZEND_HASH_FOREACH_END();
 
 #if 0
 
 #if 0
-               zend_print_zval_r(&arr, 1 TSRMLS_CC);
+               zend_print_zval_r(&arr, 1);
 #endif
 
                ALLOC_HASHTABLE(result);
                zend_hash_init(result, zend_hash_num_elements(supported), NULL, ZVAL_PTR_DTOR, 0);
 #endif
 
                ALLOC_HASHTABLE(result);
                zend_hash_init(result, zend_hash_num_elements(supported), NULL, ZVAL_PTR_DTOR, 0);
-               zend_hash_apply_with_arguments(supported TSRMLS_CC, php_http_negotiate_reduce, 4, Z_ARRVAL(arr), result, primary_sep_str, primary_sep_len);
+               zend_hash_apply_with_arguments(supported, php_http_negotiate_reduce, 4, Z_ARRVAL(arr), result, primary_sep_str, primary_sep_len);
                zend_hash_destroy(&params);
                zval_dtor(&arr);
                zend_hash_destroy(&params);
                zval_dtor(&arr);
-               zend_hash_sort(result, zend_qsort, php_http_negotiate_sort, 0 TSRMLS_CC);
+               zend_hash_sort(result, zend_qsort, php_http_negotiate_sort, 0);
        }
        
        return result;
        }
        
        return result;
index f7405b54e5111a4f66f4fffe743bd3f436384da7..598e871cd03407b95f32ee3bea014a5172fa5cdb 100644 (file)
 #ifndef PHP_HTTP_NEGOTIATE_H
 #define PHP_HTTP_NEGOTIATE_H
 
 #ifndef PHP_HTTP_NEGOTIATE_H
 #define PHP_HTTP_NEGOTIATE_H
 
-PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len TSRMLS_DC);
+PHP_HTTP_API HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len);
 
 
-static inline HashTable *php_http_negotiate_language(HashTable *supported, php_http_message_t *request TSRMLS_DC)
+static inline HashTable *php_http_negotiate_language(HashTable *supported, php_http_message_t *request)
 {
        HashTable *result = NULL;
        size_t length;
 {
        HashTable *result = NULL;
        size_t length;
-       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Language"), &length, request TSRMLS_CC);
+       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Language"), &length, request);
 
        if (value) {
 
        if (value) {
-               result = php_http_negotiate(value, length, supported, "-", 1 TSRMLS_CC);
+               result = php_http_negotiate(value, length, supported, "-", 1);
        }
        PTR_FREE(value);
 
        return result;
 }
 
        }
        PTR_FREE(value);
 
        return result;
 }
 
-static inline HashTable *php_http_negotiate_encoding(HashTable *supported, php_http_message_t *request TSRMLS_DC)
+static inline HashTable *php_http_negotiate_encoding(HashTable *supported, php_http_message_t *request)
 {
        HashTable *result = NULL;
        size_t length;
 {
        HashTable *result = NULL;
        size_t length;
-       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Encoding"), &length, request TSRMLS_CC);
+       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Encoding"), &length, request);
 
        if (value) {
 
        if (value) {
-               result = php_http_negotiate(value, length, supported, NULL, 0 TSRMLS_CC);
+               result = php_http_negotiate(value, length, supported, NULL, 0);
        }
        PTR_FREE(value);
 
        return result;
 }
 
        }
        PTR_FREE(value);
 
        return result;
 }
 
-static inline HashTable *php_http_negotiate_charset(HashTable *supported, php_http_message_t *request TSRMLS_DC)
+static inline HashTable *php_http_negotiate_charset(HashTable *supported, php_http_message_t *request)
 {
        HashTable *result = NULL;
        size_t length;
 {
        HashTable *result = NULL;
        size_t length;
-       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Charset"), &length, request TSRMLS_CC);
+       char *value = php_http_env_get_request_header(ZEND_STRL("Accept-Charset"), &length, request);
 
        if (value) {
 
        if (value) {
-               result = php_http_negotiate(value, length, supported, NULL, 0 TSRMLS_CC);
+               result = php_http_negotiate(value, length, supported, NULL, 0);
        }
        PTR_FREE(value);
 
        return result;
 }
 
        }
        PTR_FREE(value);
 
        return result;
 }
 
-static inline HashTable *php_http_negotiate_content_type(HashTable *supported, php_http_message_t *request TSRMLS_DC)
+static inline HashTable *php_http_negotiate_content_type(HashTable *supported, php_http_message_t *request)
 {
        HashTable *result = NULL;
        size_t length;
 {
        HashTable *result = NULL;
        size_t length;
-       char *value = php_http_env_get_request_header(ZEND_STRL("Accept"), &length, request TSRMLS_CC);
+       char *value = php_http_env_get_request_header(ZEND_STRL("Accept"), &length, request);
 
        if (value) {
 
        if (value) {
-               result = php_http_negotiate(value, length, supported, "/", 1 TSRMLS_CC);
+               result = php_http_negotiate(value, length, supported, "/", 1);
        }
        PTR_FREE(value);
 
        }
        PTR_FREE(value);
 
@@ -73,11 +73,11 @@ static inline HashTable *php_http_negotiate_content_type(HashTable *supported, p
 
 #define PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported) \
        { \
 
 #define PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported) \
        { \
-               zval **value; \
+               zval *value; \
                 \
                zend_hash_internal_pointer_reset((supported)); \
                 \
                zend_hash_internal_pointer_reset((supported)); \
-               if (SUCCESS == zend_hash_get_current_data((supported), (void *) &value)) { \
-                       RETVAL_ZVAL(*value, 1, 0); \
+               if ((value = zend_hash_get_current_data((supported)))) { \
+                       RETVAL_ZVAL_FAST(value); \
                } else { \
                        RETVAL_NULL(); \
                } \
                } else { \
                        RETVAL_NULL(); \
                } \
@@ -86,30 +86,30 @@ static inline HashTable *php_http_negotiate_content_type(HashTable *supported, p
 #define PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array) \
        PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported); \
        if (rs_array) { \
 #define PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array) \
        PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported); \
        if (rs_array) { \
-               HashPosition pos; \
-               zval **value_ptr; \
+               zval *value; \
                 \
                 \
-               FOREACH_HASH_VAL(pos, supported, value_ptr) { \
-                       zval *value = php_http_ztyp(IS_STRING, *value_ptr); \
-                       add_assoc_double(rs_array, Z_STRVAL_P(value), 1.0); \
-                       zval_ptr_dtor(&value); \
+               ZEND_HASH_FOREACH_VAL(supported, value) \
+               { \
+                       zend_string *zs = zval_get_string(value); \
+                       add_assoc_double_ex(rs_array, zs->val, zs->len, 1.0); \
+                       zend_string_release(zs); \
                } \
                } \
+               ZEND_HASH_FOREACH_END(); \
        }
 
 #define PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(result, supported, rs_array) \
        { \
        }
 
 #define PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(result, supported, rs_array) \
        { \
-               char *key; \
-               uint key_len; \
-               ulong idx; \
+               zend_string *key; \
+               zend_ulong idx; \
                 \
                 \
-               if (zend_hash_num_elements(result) && HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(result, &key, &key_len, &idx, 1, NULL)) { \
-                       RETVAL_STRINGL(key, key_len-1, 0); \
+               if (zend_hash_num_elements(result) && HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(result, &key, &idx, NULL)) { \
+                       RETVAL_STR_COPY(key); \
                } else { \
                        PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported); \
                } \
                \
                if (rs_array) { \
                } else { \
                        PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported); \
                } \
                \
                if (rs_array) { \
-                       zend_hash_copy(Z_ARRVAL_P(rs_array), result, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); \
+                       zend_hash_copy(Z_ARRVAL_P(rs_array), result, (copy_ctor_func_t) zval_add_ref); \
                } \
                \
                zend_hash_destroy(result); \
                } \
                \
                zend_hash_destroy(result); \
@@ -126,7 +126,6 @@ static inline HashTable *php_http_negotiate_content_type(HashTable *supported, p
                } \
        }
 
                } \
        }
 
-
 #endif
 
 /*
 #endif
 
 /*
index abf72290e26de0ad9dea5052e0d922a82602e8d2..b8589f5aec07b5bc267f781f891c6a2048ae020d 100644 (file)
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC)
+zend_object *php_http_object_new(zend_class_entry *ce)
 {
 {
-       return php_http_object_new_ex(ce, NULL, NULL TSRMLS_CC);
+       return &php_http_object_new_ex(ce, NULL)->zo;
 }
 
 }
 
-zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, php_http_object_t **ptr TSRMLS_DC)
+php_http_object_t *php_http_object_new_ex(zend_class_entry *ce, void *intern)
 {
        php_http_object_t *o;
 
 {
        php_http_object_t *o;
 
-       o = ecalloc(1, sizeof(php_http_object_t));
-       zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
-       object_properties_init((zend_object *) o, ce);
+       o = ecalloc(1, sizeof(php_http_object_t) + (ce->default_properties_count - 1) * sizeof(zval));
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
 
 
-       if (ptr) {
-               *ptr = o;
-       }
-
-       o->zv.handle = zend_objects_store_put(o, NULL, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC);
-       o->zv.handlers = zend_get_std_object_handlers();
+       o->intern = intern;
+       o->zo.handlers = zend_get_std_object_handlers();
 
 
-       return o->zv;
+       return o;
 }
 
 }
 
-STATUS php_http_new(zend_object_value *ovp, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC)
+ZEND_RESULT_CODE php_http_new(void **obj_ptr, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr)
 {
 {
-       zend_object_value ov;
+       void *obj;
 
        if (!ce) {
                ce = parent_ce;
 
        if (!ce) {
                ce = parent_ce;
-       } else if (parent_ce && !instanceof_function(ce, parent_ce TSRMLS_CC)) {
-               php_http_throw(unexpected_val, "Class %s does not extend %s", ce->name, parent_ce->name);
+       } else if (parent_ce && !instanceof_function(ce, parent_ce)) {
+               php_http_throw(unexpected_val, "Class %s does not extend %s", ce->name->val, parent_ce->name->val);
                return FAILURE;
        }
 
                return FAILURE;
        }
 
-       ov = create(ce, intern_ptr, obj_ptr TSRMLS_CC);
-       if (ovp) {
-               *ovp = ov;
+       obj = create(ce, intern_ptr);
+       if (obj_ptr) {
+               *obj_ptr = obj;
        }
        return SUCCESS;
 }
 
        }
        return SUCCESS;
 }
 
-STATUS php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval **argv[], zval **retval_ptr TSRMLS_DC)
+ZEND_RESULT_CODE php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval argv[], zval *retval_ptr)
 {
        zend_fcall_info fci;
 {
        zend_fcall_info fci;
-       zval zmethod;
        zval *retval;
        zval *retval;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        fci.size = sizeof(fci);
 
        fci.size = sizeof(fci);
-       fci.object_ptr = object;
-       fci.function_name = &zmethod;
-       fci.retval_ptr_ptr = retval_ptr ? retval_ptr : &retval;
+       fci.object = Z_OBJ_P(object);
+       fci.retval = retval_ptr ? retval_ptr : &retval;
        fci.param_count = argc;
        fci.params = argv;
        fci.no_separation = 1;
        fci.symbol_table = NULL;
        fci.function_table = NULL;
 
        fci.param_count = argc;
        fci.params = argv;
        fci.no_separation = 1;
        fci.symbol_table = NULL;
        fci.function_table = NULL;
 
-       INIT_PZVAL(&zmethod);
-       ZVAL_STRINGL(&zmethod, method_str, method_len, 0);
+       ZVAL_STRINGL(&fci.function_name, method_str, method_len);
        rv = zend_call_function(&fci, NULL TSRMLS_CC);
        rv = zend_call_function(&fci, NULL TSRMLS_CC);
+       zval_ptr_dtor(&fci.function_name);
 
        if (!retval_ptr && retval) {
                zval_ptr_dtor(&retval);
 
        if (!retval_ptr && retval) {
                zval_ptr_dtor(&retval);
index 63730b423ae195cc53d9609c43bb2048a6798ecf..7bb34f16f757b99ab250cfb6950364083516f1f2 100644 (file)
 #define PHP_HTTP_OBJECT_H
 
 typedef struct php_http_object {
 #define PHP_HTTP_OBJECT_H
 
 typedef struct php_http_object {
+       void *intern;
        zend_object zo;
        zend_object zo;
-       zend_object_value zv;
 } php_http_object_t;
 
 } php_http_object_t;
 
-zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC);
-zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, php_http_object_t **ptr TSRMLS_DC);
+zend_object *php_http_object_new(zend_class_entry *ce TSRMLS_DC);
+php_http_object_t *php_http_object_new_ex(zend_class_entry *ce, void *nothing);
 
 
-typedef zend_object_value (*php_http_new_t)(zend_class_entry *ce, void *, void ** TSRMLS_DC);
+typedef void *(*php_http_new_t)(zend_class_entry *ce, void *);
 
 
-STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC);
-STATUS php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval **argv[], zval **retval_ptr TSRMLS_DC);
+ZEND_RESULT_CODE php_http_new(void **obj_ptr, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr);
+ZEND_RESULT_CODE php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval argv[], zval *retval_ptr);
 
 #endif
 
 
 #endif
 
index 1ba987a2b0c12b864c5f244e874029ea8614593f..59b9c5f9fb6daa6fb66d6a23890f93f6f109bc29 100644 (file)
@@ -26,7 +26,7 @@ php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_boo
        return registry;
 }
 
        return registry;
 }
 
-STATUS php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata)
+ZEND_RESULT_CODE php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata)
 {
        HashPosition pos;
        zval *val;
 {
        HashPosition pos;
        zval *val;
index 67268155e7adacde6310041c410e02ae0e2f3506..2475383c3800f303e026c35b6ca230734c9cd214 100644 (file)
@@ -16,7 +16,7 @@
 typedef struct php_http_option php_http_option_t;
 typedef struct php_http_options php_http_options_t;
 
 typedef struct php_http_option php_http_option_t;
 typedef struct php_http_options php_http_options_t;
 
-typedef STATUS (*php_http_option_set_callback_t)(php_http_option_t *opt, zval *val, void *userdata);
+typedef ZEND_RESULT_CODE (*php_http_option_set_callback_t)(php_http_option_t *opt, zval *val, void *userdata);
 typedef zval *(*php_http_option_get_callback_t)(php_http_option_t *opt, HashTable *options, void *userdata);
 
 struct php_http_options {
 typedef zval *(*php_http_option_get_callback_t)(php_http_option_t *opt, HashTable *options, void *userdata);
 
 struct php_http_options {
@@ -46,7 +46,7 @@ struct php_http_option {
 };
 
 PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent);
 };
 
 PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent);
-PHP_HTTP_API STATUS php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_options_apply(php_http_options_t *registry, HashTable *options, void *userdata);
 PHP_HTTP_API void php_http_options_dtor(php_http_options_t *registry);
 PHP_HTTP_API void php_http_options_free(php_http_options_t **registry);
 
 PHP_HTTP_API void php_http_options_dtor(php_http_options_t *registry);
 PHP_HTTP_API void php_http_options_free(php_http_options_t **registry);
 
index 42f56f901c5249b2bf12d661761ab048d49a56c7..340503783e0b1f41a7c4229cfaedf5eba29d066b 100644 (file)
@@ -31,7 +31,7 @@ typedef struct php_http_params_opts {
        php_http_params_token_t **param;
        php_http_params_token_t **arg;
        php_http_params_token_t **val;
        php_http_params_token_t **param;
        php_http_params_token_t **arg;
        php_http_params_token_t **val;
-       zval *defval;
+       zval defval;
        unsigned flags;
 } php_http_params_opts_t;
 
        unsigned flags;
 } php_http_params_opts_t;
 
index 933529f628062d3a8d5e09f1b548e80490269c44..67df721b9015729fbbb030d903614ff0f92eef88 100644 (file)
 
 #define QS_MERGE 1
 
 
 #define QS_MERGE 1
 
-static inline void php_http_querystring_set(zval *instance, zval *params, int flags TSRMLS_DC)
+static inline void php_http_querystring_set(zval *instance, zval *params, int flags)
 {
 {
-       zval *qa;
+       zval qa;
+
+       array_init(&qa);
 
        if (flags & QS_MERGE) {
 
        if (flags & QS_MERGE) {
-               qa = php_http_zsep(1, IS_ARRAY, zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
-       } else {
-               MAKE_STD_ZVAL(qa);
-               array_init(qa);
+               zval *old = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0);
+
+               ZVAL_DEREF(old);
+               if (Z_TYPE_P(old) == IS_ARRAY) {
+                       array_copy(Z_ARRVAL_P(old), Z_ARRVAL(qa));
+               }
        }
 
        }
 
-       php_http_querystring_update(qa, params, NULL TSRMLS_CC);
-       zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), qa TSRMLS_CC);
-       zval_ptr_dtor(&qa);
+       php_http_querystring_update(&qa, params, NULL);
+       zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), &qa);
 }
 
 }
 
-static inline void php_http_querystring_str(zval *instance, zval *return_value TSRMLS_DC)
+static inline void php_http_querystring_str(zval *instance, zval *return_value)
 {
 {
-       zval *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+       zval *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0);
 
 
+       ZVAL_DEREF(qa);
        if (Z_TYPE_P(qa) == IS_ARRAY) {
        if (Z_TYPE_P(qa) == IS_ARRAY) {
-               php_http_querystring_update(qa, NULL, return_value TSRMLS_CC);
+               php_http_querystring_update(qa, NULL, return_value);
        } else {
                RETURN_EMPTY_STRING();
        }
 }
 
        } else {
                RETURN_EMPTY_STRING();
        }
 }
 
-static inline void php_http_querystring_get(zval *this_ptr, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC)
+static inline void php_http_querystring_get(zval *instance, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC)
 {
 {
-       zval **arrval, *qarray = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
-
-       if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
-               if (type) {
-                       zval *value = php_http_ztyp(type, *arrval);
-                       RETVAL_ZVAL(value, 1, 1);
+       zval *arrval, *qarray = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+
+       ZVAL_DEREF(qarray);
+       if ((Z_TYPE_P(qarray) == IS_ARRAY) && (arrval = zend_symtable_str_find(Z_ARRVAL_P(qarray), name, name_len))) {
+               if (type && type != Z_TYPE_P(arrval)) {
+                       SEPARATE_ZVAL(arrval);
+                       convert_to_explicit_type(arrval, type);
+                       RETVAL_ZVAL(arrval, 1, 1);
                } else {
                } else {
-                       RETVAL_ZVAL(*arrval, 1, 0);
+                       RETVAL_ZVAL_FAST(arrval);
                }
 
                if (del) {
                }
 
                if (del) {
-                       zval *delarr;
+                       zval delarr;
 
 
-                       MAKE_STD_ZVAL(delarr);
-                       array_init(delarr);
-                       add_assoc_null_ex(delarr, name, name_len + 1);
-                       php_http_querystring_set(this_ptr, delarr, QS_MERGE TSRMLS_CC);
+                       array_init(&delarr);
+                       add_assoc_null_ex(&delarr, name, name_len);
+                       php_http_querystring_set(instance, &delarr, QS_MERGE);
                        zval_ptr_dtor(&delarr);
                }
        } else if(defval) {
                        zval_ptr_dtor(&delarr);
                }
        } else if(defval) {
-               RETURN_ZVAL(defval, 1, 0);
+               RETURN_ZVAL_FAST(defval);
        }
 }
 
 #ifdef PHP_HTTP_HAVE_ICONV
        }
 }
 
 #ifdef PHP_HTTP_HAVE_ICONV
-STATUS php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC)
+ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe)
 {
 {
-       HashPosition pos;
-       zval **entry = NULL;
-       char *xlate_str = NULL, *xkey;
-       size_t xlate_len = 0, xlen;
-       php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
+       zval *entry;
+       zend_string *xkey, *xstr;
+       php_http_arrkey_t key;
        
        
-       FOREACH_KEYVAL(pos, src, key, entry) {
-               if (key.type == HASH_KEY_IS_STRING) {
-                       if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(key.str, key.len-1, &xkey, &xlen, oe, ie)) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", key.len-1, key.str, ie, oe);
+       ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(src), key.h, key.key, entry)
+       {
+               if (key.key) {
+                       if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(key.key->val, key.key->len, &xkey, oe, ie)) {
+                               php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", key.key->len, key.key->val, ie, oe);
                                return FAILURE;
                        }
                }
                
                                return FAILURE;
                        }
                }
                
-               if (Z_TYPE_PP(entry) == IS_STRING) {
-                       if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), &xlate_str, &xlate_len, oe, ie)) {
-                               if (key.type == HASH_KEY_IS_STRING) {
-                                       efree(xkey);
+               if (Z_TYPE_P(entry) == IS_STRING) {
+                       if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(Z_STRVAL_P(entry), Z_STRLEN_P(entry), &xstr, oe, ie)) {
+                               if (key.key) {
+                                       zend_string_release(xkey);
                                }
                                }
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", Z_STRLEN_PP(entry), Z_STRVAL_PP(entry), ie, oe);
+                               php_error_docref(NULL, E_WARNING, "Failed to convert '%.*s' from '%s' to '%s'", Z_STRLEN_P(entry), Z_STRVAL_P(entry), ie, oe);
                                return FAILURE;
                        }
                                return FAILURE;
                        }
-                       if (key.type == HASH_KEY_IS_STRING) {
-                               add_assoc_stringl_ex(dst, xkey, xlen+1, xlate_str, xlate_len, 0);
+                       if (key.key) {
+                               add_assoc_str_ex(dst, xkey->val, xkey->len, xstr);
                        } else {
                        } else {
-                               add_index_stringl(dst, key.num, xlate_str, xlate_len, 0);
+                               add_index_str(dst, key.h, xstr);
                        }
                        }
-               } else if (Z_TYPE_PP(entry) == IS_ARRAY) {
-                       zval *subarray;
+               } else if (Z_TYPE_P(entry) == IS_ARRAY) {
+                       zval subarray;
                        
                        
-                       MAKE_STD_ZVAL(subarray);
-                       array_init(subarray);
-                       if (key.type == HASH_KEY_IS_STRING) {
-                               add_assoc_zval_ex(dst, xkey, xlen+1, subarray);
+                       array_init(&subarray);
+                       if (key.key) {
+                               add_assoc_zval_ex(dst, xkey->val, xkey->len, &subarray);
                        } else {
                        } else {
-                               add_index_zval(dst, key.num, subarray);
+                               add_index_zval(dst, key.h, &subarray);
                        }
                        }
-                       if (SUCCESS != php_http_querystring_xlate(subarray, *entry, ie, oe TSRMLS_CC)) {
-                               if (key.type == HASH_KEY_IS_STRING) {
-                                       efree(xkey);
+                       if (SUCCESS != php_http_querystring_xlate(&subarray, entry, ie, oe)) {
+                               if (key.key) {
+                                       zend_string_release(xkey);
                                }
                                return FAILURE;
                        }
                }
                
                                }
                                return FAILURE;
                        }
                }
                
-               if (key.type == HASH_KEY_IS_STRING) {
-                       efree(xkey);
+               if (key.key) {
+                       zend_string_release(xkey);
                }
        }
                }
        }
+       ZEND_HASH_FOREACH_END();
+
        return SUCCESS;
 }
 #endif /* HAVE_ICONV */
 
        return SUCCESS;
 }
 #endif /* HAVE_ICONV */
 
-STATUS php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC)
+ZEND_RESULT_CODE php_http_querystring_ctor(zval *instance, zval *params)
 {
 {
-       php_http_querystring_set(instance, params, 0 TSRMLS_CC);
+       php_http_querystring_set(instance, params, 0);
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static int apply_querystring(void *pData TSRMLS_DC)
+static int apply_querystring(zval *val)
 {
 {
-       zval **val = pData;
-
-       if (Z_TYPE_PP(val) == IS_ARRAY) {
-               zval **zvalue;
+       if (Z_TYPE_P(val) == IS_ARRAY) {
+               zval *zvalue;
 
 
-               if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(val), ZEND_STRS("value"), (void *) &zvalue)) {
-                       zval *tmp = *val;
+               if ((zvalue = zend_hash_str_find(Z_ARRVAL_P(val), ZEND_STRL("value")))) {
+                       zval tmp;
 
 
-                       Z_ADDREF_PP(zvalue);
-                       *val = *zvalue;
-                       zval_dtor(tmp);
-                       Z_TYPE_P(tmp) = IS_NULL;
-                       zval_ptr_dtor(&tmp);
+                       ZVAL_COPY(&tmp, zvalue);
+                       zval_dtor(val);
+                       ZVAL_COPY_VALUE(val, &tmp);
                }
        }
 
        return ZEND_HASH_APPLY_KEEP;
 }
 
                }
        }
 
        return ZEND_HASH_APPLY_KEEP;
 }
 
-STATUS php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_querystring_parse(HashTable *ht, const char *str, size_t len)
 {
 {
-       STATUS rv = FAILURE;
+       ZEND_RESULT_CODE rv = FAILURE;
        php_http_params_opts_t opts;
        php_http_params_token_t psep = { ZEND_STRL("&") }, *psepp[] = { &psep, NULL };
        php_http_params_token_t vsep = { ZEND_STRL("=") }, *vsepp[] = { &vsep, NULL };
        php_http_params_opts_t opts;
        php_http_params_token_t psep = { ZEND_STRL("&") }, *psepp[] = { &psep, NULL };
        php_http_params_token_t vsep = { ZEND_STRL("=") }, *vsepp[] = { &vsep, NULL };
@@ -175,25 +176,23 @@ STATUS php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSR
        opts.flags = PHP_HTTP_PARAMS_QUERY;
 
        if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0 TSRMLS_CC) && asi_len) {
        opts.flags = PHP_HTTP_PARAMS_QUERY;
 
        if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0 TSRMLS_CC) && asi_len) {
-               zval *arr;
+               zval arr;
 
 
-               MAKE_STD_ZVAL(arr);
-               array_init_size(arr, asi_len);
+               array_init_size(&arr, asi_len);
 
                do {
 
                do {
-                       add_next_index_stringl(arr, asi_str++, 1, 1);
+                       add_next_index_stringl(&arr, asi_str++, 1);
                } while (*asi_str);
 
                } while (*asi_str);
 
-               opts.param = php_http_params_separator_init(arr TSRMLS_CC);
+               opts.param = php_http_params_separator_init(&arr);
 
                zval_ptr_dtor(&arr);
        }
 
 
                zval_ptr_dtor(&arr);
        }
 
-       MAKE_STD_ZVAL(opts.defval);
-       ZVAL_NULL(opts.defval);
+       ZVAL_NULL(&opts.defval);
 
 
-       if (php_http_params_parse(ht, &opts TSRMLS_CC)) {
-               zend_hash_apply(ht, apply_querystring TSRMLS_CC);
+       if (php_http_params_parse(ht, &opts)) {
+               zend_hash_apply(ht, apply_querystring);
                rv = SUCCESS;
        }
 
                rv = SUCCESS;
        }
 
@@ -206,7 +205,7 @@ STATUS php_http_querystring_parse(HashTable *ht, const char *str, size_t len TSR
        return rv;
 }
 
        return rv;
 }
 
-STATUS php_http_querystring_update(zval *qarray, zval *params, zval *outstring TSRMLS_DC)
+ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *outstring)
 {
        /* enforce proper type */
        if (Z_TYPE_P(qarray) != IS_ARRAY) {
 {
        /* enforce proper type */
        if (Z_TYPE_P(qarray) != IS_ARRAY) {
@@ -215,90 +214,91 @@ STATUS php_http_querystring_update(zval *qarray, zval *params, zval *outstring T
 
        /* modify qarray */
        if (params) {
 
        /* modify qarray */
        if (params) {
-               HashPosition pos;
-               HashTable *ptr;
-               php_http_array_hashkey_t key = php_http_array_hashkey_init(0);
-               zval **params_entry,  **qarray_entry;
-               zval zv, *zv_ptr = NULL;
+               HashTable *ht;
+               php_http_arrkey_t key;
+               zval zv, *params_entry, *qarray_entry;
 
 
-               INIT_PZVAL(&zv);
                ZVAL_NULL(&zv);
 
                /* squeeze the hash out of the zval */
                ZVAL_NULL(&zv);
 
                /* squeeze the hash out of the zval */
-               if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry TSRMLS_CC)) {
-                       zv_ptr = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
-                       ptr = Z_ARRVAL_P(zv_ptr);
+               if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry)) {
+                       zval *qa = zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0);
+
+                       ZVAL_DEREF(qa);
+                       convert_to_array(qa);
+                       ht = Z_ARRVAL_P(qa);
                } else if (Z_TYPE_P(params) == IS_OBJECT || Z_TYPE_P(params) == IS_ARRAY) {
                } else if (Z_TYPE_P(params) == IS_OBJECT || Z_TYPE_P(params) == IS_ARRAY) {
-                       ptr = HASH_OF(params);
+                       ht = HASH_OF(params);
                } else {
                } else {
-                       zv_ptr = php_http_ztyp(IS_STRING, params);
+                       zend_string *zs = zval_get_string(params);
+
                        array_init(&zv);
                        array_init(&zv);
-                       php_http_querystring_parse(Z_ARRVAL(zv), Z_STRVAL_P(zv_ptr), Z_STRLEN_P(zv_ptr) TSRMLS_CC);
-                       zval_ptr_dtor(&zv_ptr);
-                       zv_ptr = NULL;
-                       ptr = Z_ARRVAL(zv);
+                       php_http_querystring_parse(Z_ARRVAL(zv), zs->val, zs->len);
+                       zend_string_release(zs);
+
+                       ht = Z_ARRVAL(zv);
                }
 
                }
 
-               FOREACH_HASH_KEYVAL(pos, ptr, key, params_entry) {
+               ZEND_HASH_FOREACH_KEY_VAL(ht, key.h, key.key, params_entry)
+               {
                        /* only public properties */
                        /* only public properties */
-                       if (key.type != HASH_KEY_IS_STRING || *key.str) {
-                               if (Z_TYPE_PP(params_entry) == IS_NULL) {
+                       if (!key.key || *key.key->val) {
+                               if (Z_TYPE_P(params_entry) == IS_NULL) {
                                        /*
                                         * delete
                                         */
                                        /*
                                         * delete
                                         */
-                                       if (key.type == HASH_KEY_IS_STRING) {
-                                               zend_hash_del(Z_ARRVAL_P(qarray), key.str, key.len);
+                                       if (key.key) {
+                                               zend_hash_del(Z_ARRVAL_P(qarray), key.key);
                                        } else {
                                        } else {
-                                               zend_hash_index_del(Z_ARRVAL_P(qarray), key.num);
+                                               zend_hash_index_del(Z_ARRVAL_P(qarray), key.h);
                                        }
                                        }
-                               } else if (     ((key.type == HASH_KEY_IS_STRING) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), key.str, key.len, (void *) &qarray_entry)))
-                                               ||      ((key.type == HASH_KEY_IS_LONG) && (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(qarray), key.num, (void *) &qarray_entry)))) {
+                               } else if (     ((key.key) && (qarray_entry = zend_hash_find(Z_ARRVAL_P(qarray), key.key)))
+                                               ||      ((!key.key) && (qarray_entry = zend_hash_index_find(Z_ARRVAL_P(qarray), key.h)))) {
                                        /*
                                         * update
                                         */
                                        zval equal, *entry = NULL;
 
                                        /* recursive */
                                        /*
                                         * update
                                         */
                                        zval equal, *entry = NULL;
 
                                        /* recursive */
-                                       if (Z_TYPE_PP(params_entry) == IS_ARRAY || Z_TYPE_PP(params_entry) == IS_OBJECT) {
-                                               entry = php_http_zsep(1, IS_ARRAY, *qarray_entry);
-                                               php_http_querystring_update(entry, *params_entry, NULL TSRMLS_CC);
-                                       } else if ((FAILURE == is_equal_function(&equal, *qarray_entry, *params_entry TSRMLS_CC)) || !Z_BVAL(equal)) {
-                                               Z_ADDREF_PP(params_entry);
-                                               entry = *params_entry;
+                                       if (Z_TYPE_P(params_entry) == IS_ARRAY || Z_TYPE_P(params_entry) == IS_OBJECT) {
+                                               entry = qarray_entry;
+                                               SEPARATE_ZVAL(entry);
+                                               convert_to_array(entry);
+                                               php_http_querystring_update(entry, params_entry, NULL);
+                                       } else if ((FAILURE == is_equal_function(&equal, qarray_entry, params_entry)) || Z_TYPE(equal) != IS_TRUE) {
+                                               Z_TRY_ADDREF_P(params_entry);
+                                               entry = params_entry;
                                        }
 
                                        if (entry) {
                                        }
 
                                        if (entry) {
-                                               if (key.type == HASH_KEY_IS_STRING) {
-                                                       zend_hash_update(Z_ARRVAL_P(qarray), key.str, key.len, (void *) &entry, sizeof(zval *), NULL);
+                                               if (key.key) {
+                                                       zend_hash_update(Z_ARRVAL_P(qarray), key.key, entry);
                                                } else {
                                                } else {
-                                                       zend_hash_index_update(Z_ARRVAL_P(qarray), key.num, (void *) &entry, sizeof(zval *), NULL);
+                                                       zend_hash_index_update(Z_ARRVAL_P(qarray), key.h, entry);
                                                }
                                        }
                                } else {
                                                }
                                        }
                                } else {
-                                       zval *entry;
+                                       zval entry, *entry_ptr = &entry;
                                        /*
                                         * add
                                         */
                                        /*
                                         * add
                                         */
-                                       if (Z_TYPE_PP(params_entry) == IS_OBJECT) {
-                                               MAKE_STD_ZVAL(entry);
-                                               array_init(entry);
-                                               php_http_querystring_update(entry, *params_entry, NULL TSRMLS_CC);
+                                       if (Z_TYPE_P(params_entry) == IS_OBJECT) {
+                                               array_init(&entry);
+                                               php_http_querystring_update(&entry, params_entry, NULL);
                                        } else {
                                        } else {
-                                               Z_ADDREF_PP(params_entry);
-                                               entry = *params_entry;
+                                               Z_TRY_ADDREF_P(params_entry);
+                                               entry_ptr = params_entry;
                                        }
                                        }
-                                       if (key.type == HASH_KEY_IS_STRING) {
-                                               add_assoc_zval_ex(qarray, key.str, key.len, entry);
+                                       if (key.key) {
+                                               add_assoc_zval_ex(qarray, key.key->val, key.key->len, entry_ptr);
                                        } else {
                                        } else {
-                                               add_index_zval(qarray, key.num, entry);
+                                               add_index_zval(qarray, key.h, entry_ptr);
                                        }
                                }
                        }
                }
                                        }
                                }
                        }
                }
-               /* clean up */
-               if (zv_ptr) {
-                       zval_ptr_dtor(&zv_ptr);
-               }
+               ZEND_HASH_FOREACH_END();
+
                zval_dtor(&zv);
        }
 
                zval_dtor(&zv);
        }
 
@@ -307,11 +307,11 @@ STATUS php_http_querystring_update(zval *qarray, zval *params, zval *outstring T
                char *s;
                size_t l;
 
                char *s;
                size_t l;
 
-               if (SUCCESS == php_http_url_encode_hash(Z_ARRVAL_P(qarray), NULL, 0, &s, &l TSRMLS_CC)) {
+               if (SUCCESS == php_http_url_encode_hash(Z_ARRVAL_P(qarray), NULL, 0, &s, &l)) {
                        zval_dtor(outstring);
                        zval_dtor(outstring);
-                       ZVAL_STRINGL(outstring, s, l, 0);
+                       ZVAL_STR(outstring, php_http_cs2zs(s, l));
                } else {
                } else {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to encode query string");
+                       php_error_docref(NULL, E_WARNING, "Failed to encode query string");
                        return FAILURE;
                }
        }
                        return FAILURE;
                }
        }
@@ -329,9 +329,9 @@ PHP_METHOD(HttpQueryString, __construct)
        
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &params), invalid_arg, return);
 
        
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &params), invalid_arg, return);
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh TSRMLS_CC);
-       php_http_querystring_set(getThis(), params, 0 TSRMLS_CC);
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh);
+       php_http_querystring_set(getThis(), params, 0);
+       zend_restore_error_handling(&zeh);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getGlobalInstance, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getGlobalInstance, 0, 0, 0)
@@ -339,51 +339,54 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, getGlobalInstance)
 {
        zval *instance;
 PHP_METHOD(HttpQueryString, getGlobalInstance)
 {
        zval *instance;
+       zend_string *zs;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       instance = *zend_std_get_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), 0 PHP_HTTP_ZEND_LITERAL_CCN TSRMLS_CC);
+       zs = zend_string_init(ZEND_STRL("instance"), 0);
+       instance = zend_std_get_static_property(php_http_querystring_class_entry, zs, 0, NULL);
+       zend_string_release(zs);
 
        if (Z_TYPE_P(instance) != IS_OBJECT) {
 
        if (Z_TYPE_P(instance) != IS_OBJECT) {
-               zval **_GET = NULL;
+               zval *_GET = NULL;
+               zend_string *zs = zend_string_init("_GET", lenof("_GET"), 0);
 
 
-               zend_is_auto_global("_GET", lenof("_GET") TSRMLS_CC);
+               zend_is_auto_global(zs);
 
 
-               if ((SUCCESS == zend_hash_find(&EG(symbol_table), "_GET", sizeof("_GET"), (void *) &_GET))
-               &&      (Z_TYPE_PP(_GET) == IS_ARRAY)
+               if ((_GET = zend_hash_find(&EG(symbol_table).ht, zs))
+               &&      (Z_TYPE_P(_GET) == IS_ARRAY)
                ) {
                ) {
-                       MAKE_STD_ZVAL(instance);
-                       ZVAL_OBJVAL(instance, php_http_querystring_object_new(php_http_querystring_class_entry TSRMLS_CC), 0);
+                       zval new_instance;
 
 
-                       SEPARATE_ZVAL_TO_MAKE_IS_REF(_GET);
-                       convert_to_array(*_GET);
-                       zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), *_GET TSRMLS_CC);
+                       ZVAL_OBJ(&new_instance, php_http_querystring_object_new(php_http_querystring_class_entry));
 
 
-                       zend_update_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), instance TSRMLS_CC);
-                       zval_ptr_dtor(&instance);
+                       ZVAL_MAKE_REF(_GET);
+                       zend_update_property(php_http_querystring_class_entry, &new_instance, ZEND_STRL("queryArray"), _GET);
+
+                       zend_update_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), instance);
+                       instance = &new_instance;
                } else {
                        php_http_throw(unexpected_val, "Could not acquire reference to superglobal GET array", NULL);
                }
                } else {
                        php_http_throw(unexpected_val, "Could not acquire reference to superglobal GET array", NULL);
                }
+
+               zend_string_release(zs);
        }
 
        }
 
-       RETVAL_ZVAL(instance, 1, 0);
+       RETVAL_ZVAL_FAST(instance);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, getIterator)
 {
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, getIterator)
 {
-       zval *retval = NULL, *qa;
+       zval *qa;
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
 
        php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return);
 
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
 
        object_init_ex(return_value, spl_ce_RecursiveArrayIterator);
 
        object_init_ex(return_value, spl_ce_RecursiveArrayIterator);
-       zend_call_method_with_1_params(&return_value, spl_ce_RecursiveArrayIterator, NULL, "__construct", &retval, qa);
-       if (retval) {
-               zval_ptr_dtor(&retval);
-       }
+       zend_call_method_with_1_params(return_value, spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toString, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toString, 0, 0, 0)
@@ -393,7 +396,7 @@ PHP_METHOD(HttpQueryString, toString)
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
-       php_http_querystring_str(getThis(), return_value TSRMLS_CC);
+       php_http_querystring_str(getThis(), return_value);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toArray, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toArray, 0, 0, 0)
@@ -406,8 +409,8 @@ PHP_METHOD(HttpQueryString, toArray)
                return;
        }
 
                return;
        }
 
-       zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
-       RETURN_ZVAL(zqa, 1, 0);
+       zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       RETURN_ZVAL_FAST(zqa);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_get, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_get, 0, 0, 0)
@@ -419,12 +422,12 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, get)
 {
        char *name_str = NULL;
 PHP_METHOD(HttpQueryString, get)
 {
        char *name_str = NULL;
-       int name_len = 0;
-       long type = 0;
+       size_t name_len = 0;
+       zend_long type = 0;
        zend_bool del = 0;
        zval *ztype = NULL, *defval = NULL;
        
        zend_bool del = 0;
        zval *ztype = NULL, *defval = NULL;
        
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|szzb", &name_str, &name_len, &ztype, &defval, &del)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|szzb", &name_str, &name_len, &ztype, &defval, &del)) {
                if (name_str && name_len) {
                        if (ztype) {
                                if (Z_TYPE_P(ztype) == IS_LONG) {
                if (name_str && name_len) {
                        if (ztype) {
                                if (Z_TYPE_P(ztype) == IS_LONG) {
@@ -450,9 +453,9 @@ PHP_METHOD(HttpQueryString, get)
                                        }
                                }
                        }
                                        }
                                }
                        }
-                       php_http_querystring_get(getThis(), type, name_str, name_len, defval, del, return_value TSRMLS_CC);
+                       php_http_querystring_get(getThis(), type, name_str, name_len, defval, del, return_value);
                } else {
                } else {
-                       php_http_querystring_str(getThis(), return_value TSRMLS_CC);
+                       php_http_querystring_str(getThis(), return_value);
                }
        }
 }
                }
        }
 }
@@ -464,11 +467,11 @@ PHP_METHOD(HttpQueryString, set)
 {
        zval *params;
        
 {
        zval *params;
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &params)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", &params)) {
                return;
        }
        
                return;
        }
        
-       php_http_querystring_set(getThis(), params, QS_MERGE TSRMLS_CC);
+       php_http_querystring_set(getThis(), params, QS_MERGE);
        RETVAL_ZVAL(getThis(), 1, 0);
 }
 
        RETVAL_ZVAL(getThis(), 1, 0);
 }
 
@@ -477,15 +480,15 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_mod, 0, 0, 0)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, mod)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, mod)
 {
-       zval *params;
+       zval *params, *instance = getThis();
        zend_error_handling zeh;
 
        zend_error_handling zeh;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &params), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &params), invalid_arg, return);
        
        
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh TSRMLS_CC);
-       ZVAL_OBJVAL(return_value, Z_OBJ_HT_P(getThis())->clone_obj(getThis() TSRMLS_CC), 0);
-       php_http_querystring_set(return_value, params, QS_MERGE TSRMLS_CC);
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh);
+       ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(instance));
+       php_http_querystring_set(return_value, params, QS_MERGE);
+       zend_restore_error_handling(&zeh);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString___getter, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString___getter, 0, 0, 1)
@@ -497,14 +500,14 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, method) \
 { \
        char *name; \
 PHP_METHOD(HttpQueryString, method) \
 { \
        char *name; \
-       int name_len; \
+       size_t name_len; \
        zval *defval = NULL; \
        zend_bool del = 0; \
        zval *defval = NULL; \
        zend_bool del = 0; \
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|zb", &name, &name_len, &defval, &del)) { \
-               php_http_querystring_get(getThis(), TYPE, name, name_len, defval, del, return_value TSRMLS_CC); \
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s|zb", &name, &name_len, &defval, &del)) { \
+               php_http_querystring_get(getThis(), TYPE, name, name_len, defval, del, return_value); \
        } \
 }
        } \
 }
-PHP_HTTP_QUERYSTRING_GETTER(getBool, IS_BOOL);
+PHP_HTTP_QUERYSTRING_GETTER(getBool, _IS_BOOL);
 PHP_HTTP_QUERYSTRING_GETTER(getInt, IS_LONG);
 PHP_HTTP_QUERYSTRING_GETTER(getFloat, IS_DOUBLE);
 PHP_HTTP_QUERYSTRING_GETTER(getString, IS_STRING);
 PHP_HTTP_QUERYSTRING_GETTER(getInt, IS_LONG);
 PHP_HTTP_QUERYSTRING_GETTER(getFloat, IS_DOUBLE);
 PHP_HTTP_QUERYSTRING_GETTER(getString, IS_STRING);
@@ -519,26 +522,25 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, xlate)
 {
        char *ie, *oe;
 PHP_METHOD(HttpQueryString, xlate)
 {
        char *ie, *oe;
-       int ie_len, oe_len;
-       zval *na, *qa;
+       size_t ie_len, oe_len;
+       zval na, *qa;
 
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &ie, &ie_len, &oe, &oe_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &ie, &ie_len, &oe, &oe_len), invalid_arg, return);
 
 
-       MAKE_STD_ZVAL(na);
-       array_init(na);
-       qa = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC));
+       array_init(&na);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       ZVAL_DEREF(qa);
+       convert_to_array(qa);
 
 
-       php_http_expect(SUCCESS == php_http_querystring_xlate(na, qa, ie, oe TSRMLS_CC), bad_conversion,
+       php_http_expect(SUCCESS == php_http_querystring_xlate(&na, qa, ie, oe), bad_conversion,
                        zval_ptr_dtor(&na);
                        zval_ptr_dtor(&na);
-                       zval_ptr_dtor(&qa);
                        return;
        );
 
                        return;
        );
 
-       php_http_querystring_set(getThis(), na, 0 TSRMLS_CC);
-       RETVAL_ZVAL(getThis(), 1, 0);
+       php_http_querystring_set(getThis(), &na, 0);
+       RETVAL_ZVAL_FAST(getThis());
        
        zval_ptr_dtor(&na);
        
        zval_ptr_dtor(&na);
-       zval_ptr_dtor(&qa);
 }
 #endif /* HAVE_ICONV */
 
 }
 #endif /* HAVE_ICONV */
 
@@ -549,7 +551,7 @@ PHP_METHOD(HttpQueryString, serialize)
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
        if (SUCCESS != zend_parse_parameters_none()) {
                return;
        }
-       php_http_querystring_str(getThis(), return_value TSRMLS_CC);
+       php_http_querystring_str(getThis(), return_value);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_unserialize, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_unserialize, 0, 0, 1)
@@ -559,14 +561,14 @@ PHP_METHOD(HttpQueryString, unserialize)
 {
        zval *serialized;
        
 {
        zval *serialized;
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &serialized)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", &serialized)) {
                return;
        }
 
        if (Z_TYPE_P(serialized) == IS_STRING) {
                return;
        }
 
        if (Z_TYPE_P(serialized) == IS_STRING) {
-               php_http_querystring_set(getThis(), serialized, 0 TSRMLS_CC);
+               php_http_querystring_set(getThis(), serialized, 0);
        } else {
        } else {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected a string as parameter");
+               php_error_docref(NULL, E_WARNING, "Expected a string as parameter");
        }
 }
 
        }
 }
 
@@ -575,19 +577,19 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetGet)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetGet)
 {
-       char *offset_str;
-       int offset_len;
-       zval **value, *qa;
+       zend_string *offset;
+       zval *value, *qa;
 
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
                return;
        }
        
                return;
        }
        
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       ZVAL_DEREF(qa);
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
-               if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)) {
-                       RETVAL_ZVAL(*value, 1, 0);
+               if ((value = zend_symtable_find(Z_ARRVAL_P(qa), offset))) {
+                       RETVAL_ZVAL_FAST(value);
                }
        }
 }
                }
        }
 }
@@ -598,19 +600,17 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetSet)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetSet)
 {
-       char *offset_str;
-       int offset_len;
-       zval *value, *param;
+       zend_string *offset;
+       zval *value, param;
        
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &offset_str, &offset_len, &value)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &offset, &value)) {
                return;
        }
 
                return;
        }
 
-       MAKE_STD_ZVAL(param);
-       array_init(param);
-       Z_ADDREF_P(value);
-       add_assoc_zval_ex(param, offset_str, offset_len + 1, value);
-       php_http_querystring_set(getThis(), param, 0 TSRMLS_CC);
+       array_init(&param);
+       Z_TRY_ADDREF_P(value);
+       zend_symtable_update(Z_ARRVAL(param), offset, value);
+       php_http_querystring_set(getThis(), &param, 0);
        zval_ptr_dtor(&param);
 }
 
        zval_ptr_dtor(&param);
 }
 
@@ -619,19 +619,19 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetExists)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetExists)
 {
-       char *offset_str;
-       int offset_len;
-       zval **value, *qa;
+       zend_string *offset;
+       zval *value, *qa;
 
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
                return;
        }
        
                return;
        }
        
-       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+       qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0);
+       ZVAL_DEREF(qa);
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
 
        if (Z_TYPE_P(qa) == IS_ARRAY) {
-               if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)) {
-                       RETURN_BOOL(Z_TYPE_PP(value) != IS_NULL);
+               if ((value = zend_symtable_find(Z_ARRVAL_P(qa), offset))) {
+                       RETURN_BOOL(Z_TYPE_P(value) != IS_NULL);
                }
        }
        RETURN_FALSE;
                }
        }
        RETURN_FALSE;
@@ -642,18 +642,17 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1)
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetUnset)
 {
 ZEND_END_ARG_INFO();
 PHP_METHOD(HttpQueryString, offsetUnset)
 {
-       char *offset_str;
-       int offset_len;
-       zval *param;
+       zend_string *offset;
+       zval param, znull;
        
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &offset_str, &offset_len)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &offset)) {
                return;
        }
 
                return;
        }
 
-       MAKE_STD_ZVAL(param);
-       array_init(param);
-       add_assoc_null_ex(param, offset_str, offset_len + 1);
-       php_http_querystring_set(getThis(), param, QS_MERGE TSRMLS_CC);
+       array_init(&param);
+       ZVAL_NULL(&znull);
+       zend_symtable_update(Z_ARRVAL(param), offset, &znull);
+       php_http_querystring_set(getThis(), &param, QS_MERGE);
        zval_ptr_dtor(&param);
 }
 
        zval_ptr_dtor(&param);
 }
 
@@ -702,19 +701,19 @@ PHP_MINIT_FUNCTION(http_querystring)
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "QueryString", php_http_querystring_methods);
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http", "QueryString", php_http_querystring_methods);
-       php_http_querystring_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+       php_http_querystring_class_entry = zend_register_internal_class(&ce);
        php_http_querystring_class_entry->create_object = php_http_querystring_object_new;
        php_http_querystring_class_entry->create_object = php_http_querystring_object_new;
-       zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
+       zend_class_implements(php_http_querystring_class_entry, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
 
 
-       zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("instance"), (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC);
-       zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("queryArray"), ZEND_ACC_PRIVATE TSRMLS_CC);
+       zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("instance"), (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE));
+       zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("queryArray"), ZEND_ACC_PRIVATE);
 
 
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_BOOL"), PHP_HTTP_QUERYSTRING_TYPE_BOOL TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_INT"), PHP_HTTP_QUERYSTRING_TYPE_INT TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_FLOAT"), PHP_HTTP_QUERYSTRING_TYPE_FLOAT TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_STRING"), PHP_HTTP_QUERYSTRING_TYPE_STRING TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_ARRAY"), PHP_HTTP_QUERYSTRING_TYPE_ARRAY TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_OBJECT"), PHP_HTTP_QUERYSTRING_TYPE_OBJECT TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_BOOL"), PHP_HTTP_QUERYSTRING_TYPE_BOOL);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_INT"), PHP_HTTP_QUERYSTRING_TYPE_INT);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_FLOAT"), PHP_HTTP_QUERYSTRING_TYPE_FLOAT);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_STRING"), PHP_HTTP_QUERYSTRING_TYPE_STRING);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_ARRAY"), PHP_HTTP_QUERYSTRING_TYPE_ARRAY);
+       zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_OBJECT"), PHP_HTTP_QUERYSTRING_TYPE_OBJECT);
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
index 4ebdd77db37b44e5affc580b436d6327d218dc8f..d41b8e9065ffce11455ba627a867bcf79f083403 100644 (file)
 #define PHP_HTTP_QUERYSTRING_H
 
 #ifdef PHP_HTTP_HAVE_ICONV
 #define PHP_HTTP_QUERYSTRING_H
 
 #ifdef PHP_HTTP_HAVE_ICONV
-PHP_HTTP_API STATUS php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_xlate(zval *dst, zval *src, const char *ie, const char *oe);
 #endif /* PHP_HTTP_HAVE_ICONV */
 #endif /* PHP_HTTP_HAVE_ICONV */
-PHP_HTTP_API STATUS php_http_querystring_update(zval *qarray, zval *params, zval *qstring TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_querystring_ctor(zval *instance, zval *params TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *qstring);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_querystring_ctor(zval *instance, zval *params);
 
 typedef php_http_object_t php_http_querystring_object_t;
 
 
 typedef php_http_object_t php_http_querystring_object_t;
 
-#define PHP_HTTP_QUERYSTRING_TYPE_BOOL         IS_BOOL
+#define PHP_HTTP_QUERYSTRING_TYPE_BOOL         _IS_BOOL
 #define PHP_HTTP_QUERYSTRING_TYPE_INT          IS_LONG
 #define PHP_HTTP_QUERYSTRING_TYPE_FLOAT                IS_DOUBLE
 #define PHP_HTTP_QUERYSTRING_TYPE_STRING       IS_STRING
 #define PHP_HTTP_QUERYSTRING_TYPE_INT          IS_LONG
 #define PHP_HTTP_QUERYSTRING_TYPE_FLOAT                IS_DOUBLE
 #define PHP_HTTP_QUERYSTRING_TYPE_STRING       IS_STRING
index f4571780005bf7d3a61bbf4df1ba3cec4425c031..6b7d8e8f8b42b343b35a2588a893172db080bb79 100644 (file)
@@ -55,7 +55,7 @@ const char *php_http_strlist_iterator_next(php_http_strlist_iterator_t *iter)
 
 void php_http_strlist_iterator_dtor(php_http_strlist_iterator_t *iter)
 {
 
 void php_http_strlist_iterator_dtor(php_http_strlist_iterator_t *iter)
 {
-
+       (void) iter;
 }
 
 void php_http_strlist_iterator_free(php_http_strlist_iterator_t **iter)
 }
 
 void php_http_strlist_iterator_free(php_http_strlist_iterator_t **iter)
index 40fffbad92bd666c20cf5eceee6535e03b6890bd..93849baf077efc3eb2ae657032cf30f3cdd8ab58 100644 (file)
@@ -59,7 +59,7 @@ static inline char *localhostname(void)
 
 #define url(buf) ((php_http_url_t *) buf.data)
 
 
 #define url(buf) ((php_http_url_t *) buf.data)
 
-static php_http_url_t *php_http_url_from_env(TSRMLS_D)
+static php_http_url_t *php_http_url_from_env(void)
 {
        zval *https, *zhost, *zport;
        long port;
 {
        zval *https, *zhost, *zport;
        long port;
@@ -71,7 +71,7 @@ static php_http_url_t *php_http_url_from_env(TSRMLS_D)
 
        /* scheme */
        url(buf)->scheme = &buf.data[buf.used];
 
        /* scheme */
        url(buf)->scheme = &buf.data[buf.used];
-       https = php_http_env_get_server_var(ZEND_STRL("HTTPS"), 1 TSRMLS_CC);
+       https = php_http_env_get_server_var(ZEND_STRL("HTTPS"), 1);
        if (https && !strcasecmp(Z_STRVAL_P(https), "ON")) {
                php_http_buffer_append(&buf, "https", sizeof("https"));
        } else {
        if (https && !strcasecmp(Z_STRVAL_P(https), "ON")) {
                php_http_buffer_append(&buf, "https", sizeof("https"));
        } else {
@@ -80,9 +80,9 @@ static php_http_url_t *php_http_url_from_env(TSRMLS_D)
 
        /* host */
        url(buf)->host = &buf.data[buf.used];
 
        /* host */
        url(buf)->host = &buf.data[buf.used];
-       if ((((zhost = php_http_env_get_server_var(ZEND_STRL("HTTP_HOST"), 1 TSRMLS_CC)) ||
-                       (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_NAME"), 1 TSRMLS_CC)) ||
-                       (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_ADDR"), 1 TSRMLS_CC)))) && Z_STRLEN_P(zhost)) {
+       if ((((zhost = php_http_env_get_server_var(ZEND_STRL("HTTP_HOST"), 1)) ||
+                       (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_NAME"), 1)) ||
+                       (zhost = php_http_env_get_server_var(ZEND_STRL("SERVER_ADDR"), 1)))) && Z_STRLEN_P(zhost)) {
                size_t stop_at = strspn(Z_STRVAL_P(zhost), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.");
 
                php_http_buffer_append(&buf, Z_STRVAL_P(zhost), stop_at);
                size_t stop_at = strspn(Z_STRVAL_P(zhost), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.");
 
                php_http_buffer_append(&buf, Z_STRVAL_P(zhost), stop_at);
@@ -95,7 +95,7 @@ static php_http_url_t *php_http_url_from_env(TSRMLS_D)
        }
 
        /* port */
        }
 
        /* port */
-       zport = php_http_env_get_server_var(ZEND_STRL("SERVER_PORT"), 1 TSRMLS_CC);
+       zport = php_http_env_get_server_var(ZEND_STRL("SERVER_PORT"), 1);
        if (zport && IS_LONG == is_numeric_string(Z_STRVAL_P(zport), Z_STRLEN_P(zport), &port, NULL, 0)) {
                url(buf)->port = port;
        }
        if (zport && IS_LONG == is_numeric_string(Z_STRVAL_P(zport), Z_STRLEN_P(zport), &port, NULL, 0)) {
                url(buf)->port = port;
        }
@@ -123,20 +123,6 @@ static php_http_url_t *php_http_url_from_env(TSRMLS_D)
        return url(buf);
 }
 
        return url(buf);
 }
 
-void php_http_url(int flags, const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC)
-{
-       php_http_url_t *url = php_http_url_mod((const php_http_url_t *) old_url, (const php_http_url_t *) new_url, flags TSRMLS_CC);
-
-       if (url_ptr) {
-               *url_ptr = php_http_url_to_php_url(url);
-       }
-       if (url_str) {
-               php_http_url_to_string(url, url_str, url_len, 0);
-       }
-
-       php_http_url_free(&url);
-}
-
 #define url_isset(u,n) \
        ((u)&&(u)->n)
 #define url_copy(n) do { \
 #define url_isset(u,n) \
        ((u)&&(u)->n)
 #define url_copy(n) do { \
@@ -149,7 +135,7 @@ void php_http_url(int flags, const php_url *old_url, const php_url *new_url, php
        } \
 } while (0)
 
        } \
 } while (0)
 
-php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_url_t *new_url, unsigned flags TSRMLS_DC)
+php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_url_t *new_url, unsigned flags)
 {
        php_http_url_t *tmp_url = NULL;
        php_http_buffer_t buf;
 {
        php_http_url_t *tmp_url = NULL;
        php_http_buffer_t buf;
@@ -160,9 +146,9 @@ php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_u
 
        /* set from env if requested */
        if (flags & PHP_HTTP_URL_FROM_ENV) {
 
        /* set from env if requested */
        if (flags & PHP_HTTP_URL_FROM_ENV) {
-               php_http_url_t *env_url = php_http_url_from_env(TSRMLS_C);
+               php_http_url_t *env_url = php_http_url_from_env();
 
 
-               old_url = tmp_url = php_http_url_mod(env_url, old_url, flags ^ PHP_HTTP_URL_FROM_ENV TSRMLS_CC);
+               old_url = tmp_url = php_http_url_mod(env_url, old_url, flags ^ PHP_HTTP_URL_FROM_ENV);
                php_http_url_free(&env_url);
        }
 
                php_http_url_free(&env_url);
        }
 
@@ -223,17 +209,15 @@ php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_u
                if ((flags & PHP_HTTP_URL_JOIN_QUERY) && url_isset(new_url, query) && url_isset(old_url, query)) {
                        zval qarr, qstr;
                        
                if ((flags & PHP_HTTP_URL_JOIN_QUERY) && url_isset(new_url, query) && url_isset(old_url, query)) {
                        zval qarr, qstr;
                        
-                       INIT_PZVAL(&qstr);
-                       INIT_PZVAL(&qarr);
                        array_init(&qarr);
                        
                        array_init(&qarr);
                        
-                       ZVAL_STRING(&qstr, old_url->query, 0);
-                       php_http_querystring_update(&qarr, &qstr, NULL TSRMLS_CC);
-                       ZVAL_STRING(&qstr, new_url->query, 0);
-                       php_http_querystring_update(&qarr, &qstr, NULL TSRMLS_CC);
+                       ZVAL_STR(&qstr, php_http_cs2zs(old_url->query, strlen(old_url->query)));
+                       php_http_querystring_update(&qarr, &qstr, NULL);
+                       ZVAL_STR(&qstr, php_http_cs2zs(new_url->query, strlen(new_url->query)));
+                       php_http_querystring_update(&qarr, &qstr, NULL);
                        
                        ZVAL_NULL(&qstr);
                        
                        ZVAL_NULL(&qstr);
-                       php_http_querystring_update(&qarr, NULL, &qstr TSRMLS_CC);
+                       php_http_querystring_update(&qarr, NULL, &qstr);
 
                        url(buf)->query = &buf.data[buf.used];
                        php_http_buffer_append(&buf, Z_STRVAL(qstr), Z_STRLEN(qstr) + 1);
 
                        url(buf)->query = &buf.data[buf.used];
                        php_http_buffer_append(&buf, Z_STRVAL(qstr), Z_STRLEN(qstr) + 1);
@@ -381,9 +365,9 @@ char *php_http_url_to_string(const php_http_url_t *url, char **url_str, size_t *
        return buf.data;
 }
 
        return buf.data;
 }
 
-php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags TSRMLS_DC)
+php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags)
 {
 {
-       zval *zcpy;
+       zend_string *zs;
        php_http_url_t *purl;
 
        switch (Z_TYPE_P(value)) {
        php_http_url_t *purl;
 
        switch (Z_TYPE_P(value)) {
@@ -393,9 +377,9 @@ php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags TSRMLS_DC)
                break;
 
        default:
                break;
 
        default:
-               zcpy = php_http_ztyp(IS_STRING, value);
-               purl = php_http_url_parse(Z_STRVAL_P(zcpy), Z_STRLEN_P(zcpy), flags TSRMLS_CC);
-               zval_ptr_dtor(&zcpy);
+               zs = zval_get_string(value);
+               purl = php_http_url_parse(zs->val, zs->len, flags);
+               zend_string_release(zs);
        }
 
        return purl;
        }
 
        return purl;
@@ -403,67 +387,66 @@ php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags TSRMLS_DC)
 
 php_http_url_t *php_http_url_from_struct(HashTable *ht)
 {
 
 php_http_url_t *php_http_url_from_struct(HashTable *ht)
 {
-       zval **e;
+       zval *e;
        php_http_buffer_t buf;
 
        php_http_buffer_init_ex(&buf, MAX(PHP_HTTP_BUFFER_DEFAULT_SIZE, sizeof(php_http_url_t)<<2), PHP_HTTP_BUFFER_INIT_PREALLOC);
        php_http_buffer_account(&buf, sizeof(php_http_url_t));
        memset(buf.data, 0, buf.used);
 
        php_http_buffer_t buf;
 
        php_http_buffer_init_ex(&buf, MAX(PHP_HTTP_BUFFER_DEFAULT_SIZE, sizeof(php_http_url_t)<<2), PHP_HTTP_BUFFER_INIT_PREALLOC);
        php_http_buffer_account(&buf, sizeof(php_http_url_t));
        memset(buf.data, 0, buf.used);
 
-       if (SUCCESS == zend_hash_find(ht, "scheme", sizeof("scheme"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("scheme")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->scheme = &buf.data[buf.used];
                url(buf)->scheme = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "user", sizeof("user"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("user")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->user = &buf.data[buf.used];
                url(buf)->user = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "pass", sizeof("pass"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("pass")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->pass = &buf.data[buf.used];
                url(buf)->pass = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "host", sizeof("host"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("host")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->host = &buf.data[buf.used];
                url(buf)->host = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "port", sizeof("port"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_LONG, *e);
-               url(buf)->port = (unsigned short) Z_LVAL_P(cpy);
-               zval_ptr_dtor(&cpy);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("port")))) {
+               url(buf)->port = (unsigned short) zval_get_long(e);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "path", sizeof("path"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("path")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->path = &buf.data[buf.used];
                url(buf)->path = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "query", sizeof("query"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("query")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->query = &buf.data[buf.used];
                url(buf)->query = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
        }
-       if (SUCCESS == zend_hash_find(ht, "fragment", sizeof("fragment"), (void *) &e)) {
-               zval *cpy = php_http_ztyp(IS_STRING, *e);
+       if ((e = zend_hash_str_find(ht, ZEND_STRL("fragment")))) {
+               zend_string *zs = zval_get_string(e);
                url(buf)->fragment = &buf.data[buf.used];
                url(buf)->fragment = &buf.data[buf.used];
-               php_http_buffer_append(&buf, Z_STRVAL_P(cpy), Z_STRLEN_P(cpy) + 1);
-               zval_ptr_dtor(&cpy);
+               php_http_buffer_append(&buf, zs->val, zs->len + 1);
+               zend_string_release(zs);
        }
 
        return url(buf);
 }
 
        }
 
        return url(buf);
 }
 
-HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct TSRMLS_DC)
+HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct)
 {
 {
-       zval arr;
+       HashTable *ht;
+       zval tmp;
 
        if (strct) {
                switch (Z_TYPE_P(strct)) {
 
        if (strct) {
                switch (Z_TYPE_P(strct)) {
@@ -473,53 +456,61 @@ HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct TSRMLS_
                                /* no break */
                        case IS_ARRAY:
                        case IS_OBJECT:
                                /* no break */
                        case IS_ARRAY:
                        case IS_OBJECT:
-                               INIT_PZVAL_ARRAY((&arr), HASH_OF(strct));
+                               ht = HASH_OF(strct);
                                break;
                }
        } else {
                                break;
                }
        } else {
-               INIT_PZVAL(&arr);
-               array_init(&arr);
+               ALLOC_HASHTABLE(ht);
+               zend_hash_init(ht, 8, NULL, ZVAL_PTR_DTOR, 0);
        }
 
        if (url) {
                if (url->scheme) {
        }
 
        if (url) {
                if (url->scheme) {
-                       add_assoc_string(&arr, "scheme", url->scheme, 1);
+                       ZVAL_STRING(&tmp, url->scheme);
+                       zend_hash_str_update(ht, "scheme", lenof("scheme"), &tmp);
                }
                if (url->user) {
                }
                if (url->user) {
-                       add_assoc_string(&arr, "user", url->user, 1);
+                       ZVAL_STRING(&tmp, url->user);
+                       zend_hash_str_update(ht, "user", lenof("user"), &tmp);
                }
                if (url->pass) {
                }
                if (url->pass) {
-                       add_assoc_string(&arr, "pass", url->pass, 1);
+                       ZVAL_STRING(&tmp, url->pass);
+                       zend_hash_str_update(ht, "pass", lenof("pass"), &tmp);
                }
                if (url->host) {
                }
                if (url->host) {
-                       add_assoc_string(&arr, "host", url->host, 1);
+                       ZVAL_STRING(&tmp, url->host);
+                       zend_hash_str_update(ht, "host", lenof("host"), &tmp);
                }
                if (url->port) {
                }
                if (url->port) {
-                       add_assoc_long(&arr, "port", (long) url->port);
+                       ZVAL_LONG(&tmp, url->port);
+                       zend_hash_str_update(ht, "port", lenof("port"), &tmp);
                }
                if (url->path) {
                }
                if (url->path) {
-                       add_assoc_string(&arr, "path", url->path, 1);
+                       ZVAL_STRING(&tmp, url->path);
+                       zend_hash_str_update(ht, "path", lenof("path"), &tmp);
                }
                if (url->query) {
                }
                if (url->query) {
-                       add_assoc_string(&arr, "query", url->query, 1);
+                       ZVAL_STRING(&tmp, url->query);
+                       zend_hash_str_update(ht, "query", lenof("query"), &tmp);
                }
                if (url->fragment) {
                }
                if (url->fragment) {
-                       add_assoc_string(&arr, "fragment", url->fragment, 1);
+                       ZVAL_STRING(&tmp, url->fragment);
+                       zend_hash_str_update(ht, "fragment", lenof("fragment"), &tmp);
                }
        }
 
                }
        }
 
-       return Z_ARRVAL(arr);
+       return ht;
 }
 
 }
 
-STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len)
 {
        const char *arg_sep_str;
        size_t arg_sep_len;
        php_http_buffer_t *qstr = php_http_buffer_new();
 
 {
        const char *arg_sep_str;
        size_t arg_sep_len;
        php_http_buffer_t *qstr = php_http_buffer_new();
 
-       php_http_url_argsep(&arg_sep_str, &arg_sep_len TSRMLS_CC);
+       php_http_url_argsep(&arg_sep_str, &arg_sep_len);
 
 
-       if (SUCCESS != php_http_url_encode_hash_ex(hash, qstr, arg_sep_str, arg_sep_len, "=", 1, pre_encoded_str, pre_encoded_len TSRMLS_CC)) {
+       if (SUCCESS != php_http_url_encode_hash_ex(hash, qstr, arg_sep_str, arg_sep_len, "=", 1, pre_encoded_str, pre_encoded_len)) {
                php_http_buffer_free(&qstr);
                return FAILURE;
        }
                php_http_buffer_free(&qstr);
                return FAILURE;
        }
@@ -530,13 +521,13 @@ STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, si
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-STATUS php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len)
 {
        if (pre_encoded_len && pre_encoded_str) {
                php_http_buffer_append(qstr, pre_encoded_str, pre_encoded_len);
        }
 
 {
        if (pre_encoded_len && pre_encoded_str) {
                php_http_buffer_append(qstr, pre_encoded_str, pre_encoded_len);
        }
 
-       if (!php_http_params_to_string(qstr, hash, arg_sep_str, arg_sep_len, "", 0, val_sep_str, val_sep_len, PHP_HTTP_PARAMS_QUERY TSRMLS_CC)) {
+       if (!php_http_params_to_string(qstr, hash, arg_sep_str, arg_sep_len, "", 0, val_sep_str, val_sep_len, PHP_HTTP_PARAMS_QUERY)) {
                return FAILURE;
        }
 
                return FAILURE;
        }
 
@@ -545,9 +536,6 @@ STATUS php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, con
 
 struct parse_state {
        php_http_url_t url;
 
 struct parse_state {
        php_http_url_t url;
-#ifdef ZTS
-       void ***ts;
-#endif
        const char *ptr;
        const char *end;
        size_t maxlen;
        const char *ptr;
        const char *end;
        size_t maxlen;
@@ -705,8 +693,7 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch
        }
 
        if (!silent) {
        }
 
        if (!silent) {
-               TSRMLS_FETCH_FROM_CTX(state->ts);
-               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+               php_error_docref(NULL, E_WARNING,
                                "Failed to parse %s; unexpected byte 0x%02x at pos %u in '%s'",
                                parse_what[what], (unsigned char) *ptr, (unsigned) (ptr - begin), begin);
        }
                                "Failed to parse %s; unexpected byte 0x%02x at pos %u in '%s'",
                                parse_what[what], (unsigned char) *ptr, (unsigned) (ptr - begin), begin);
        }
@@ -714,11 +701,10 @@ static size_t parse_mb(struct parse_state *state, parse_mb_what_t what, const ch
        return 0;
 }
 
        return 0;
 }
 
-static STATUS parse_userinfo(struct parse_state *state, const char *ptr)
+static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *ptr)
 {
        size_t mb;
        const char *password = NULL, *end = state->ptr, *tmp = ptr;
 {
        size_t mb;
        const char *password = NULL, *end = state->ptr, *tmp = ptr;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        state->url.user = &state->buffer[state->offset];
 
 
        state->url.user = &state->buffer[state->offset];
 
@@ -726,7 +712,7 @@ static STATUS parse_userinfo(struct parse_state *state, const char *ptr)
                switch (*ptr) {
                case ':':
                        if (password) {
                switch (*ptr) {
                case ':':
                        if (password) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse password; duplicate ':' at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse password; duplicate ':' at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -738,7 +724,7 @@ static STATUS parse_userinfo(struct parse_state *state, const char *ptr)
 
                case '%':
                        if (ptr[1] != '%' && (end - ptr <= 2 || !isxdigit(*(ptr+1)) || !isxdigit(*(ptr+2)))) {
 
                case '%':
                        if (ptr[1] != '%' && (end - ptr <= 2 || !isxdigit(*(ptr+1)) || !isxdigit(*(ptr+2)))) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse userinfo; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse userinfo; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -779,11 +765,10 @@ static STATUS parse_userinfo(struct parse_state *state, const char *ptr)
        return SUCCESS;
 }
 
        return SUCCESS;
 }
 
-static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
+static ZEND_RESULT_CODE parse_hostinfo(struct parse_state *state, const char *ptr)
 {
        size_t mb, len;
        const char *end = state->ptr, *tmp = ptr, *port = NULL;
 {
        size_t mb, len;
        const char *end = state->ptr, *tmp = ptr, *port = NULL;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
 
 #ifdef HAVE_INET_PTON
 
 
 #ifdef HAVE_INET_PTON
@@ -814,7 +799,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
                }
 
                if (error) {
                }
 
                if (error) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse hostinfo; %s", error);
+                       php_error_docref(NULL, E_WARNING, "Failed to parse hostinfo; %s", error);
                        return FAILURE;
                }
        }
                        return FAILURE;
                }
        }
@@ -823,7 +808,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
                switch (*ptr) {
                case ':':
                        if (port) {
                switch (*ptr) {
                case ':':
                        if (port) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse port; unexpected ':' at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse port; unexpected ':' at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -833,7 +818,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
 
                case '%':
                        if (ptr[1] != '%' && (end - ptr <= 2 || !isxdigit(*(ptr+1)) || !isxdigit(*(ptr+2)))) {
 
                case '%':
                        if (ptr[1] != '%' && (end - ptr <= 2 || !isxdigit(*(ptr+1)) || !isxdigit(*(ptr+2)))) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse hostinfo; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse hostinfo; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -855,7 +840,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
                case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
                case 'v': case 'w': case 'x': case 'y': case 'z':
                        if (port) {
                case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
                case 'v': case 'w': case 'x': case 'y': case 'z':
                        if (port) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse port; unexpected char '%c' at pos %u in '%s'",
                                                (unsigned char) *ptr, (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse port; unexpected char '%c' at pos %u in '%s'",
                                                (unsigned char) *ptr, (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -874,7 +859,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
 
                default:
                        if (port) {
 
                default:
                        if (port) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse port; unexpected byte 0x%02x at pos %u in '%s'",
                                                (unsigned char) *ptr, (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
                                                "Failed to parse port; unexpected byte 0x%02x at pos %u in '%s'",
                                                (unsigned char) *ptr, (unsigned) (ptr - tmp), tmp);
                                return FAILURE;
@@ -905,7 +890,7 @@ static STATUS parse_hostinfo(struct parse_state *state, const char *ptr)
                }
 #      endif
                if (rv != IDNA_SUCCESS) {
                }
 #      endif
                if (rv != IDNA_SUCCESS) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse IDN; %s", idna_strerror(rv));
+                       php_error_docref(NULL, E_WARNING, "Failed to parse IDN; %s", idna_strerror(rv));
                        return FAILURE;
                } else {
                        size_t idnlen = strlen(idn);
                        return FAILURE;
                } else {
                        size_t idnlen = strlen(idn);
@@ -928,8 +913,7 @@ static const char *parse_authority(struct parse_state *state)
                case '@':
                        /* userinfo delimiter */
                        if (host) {
                case '@':
                        /* userinfo delimiter */
                        if (host) {
-                               TSRMLS_FETCH_FROM_CTX(state->ts);
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse userinfo; unexpected '@'");
                                return NULL;
                        }
                                                "Failed to parse userinfo; unexpected '@'");
                                return NULL;
                        }
@@ -959,7 +943,6 @@ static const char *parse_path(struct parse_state *state)
 {
        size_t mb;
        const char *tmp;
 {
        size_t mb;
        const char *tmp;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        /* is there actually a path to parse? */
        if (!*state->ptr) {
 
        /* is there actually a path to parse? */
        if (!*state->ptr) {
@@ -976,7 +959,7 @@ static const char *parse_path(struct parse_state *state)
 
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
 
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse path; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
                                                "Failed to parse path; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
@@ -1027,7 +1010,6 @@ static const char *parse_query(struct parse_state *state)
 {
        size_t mb;
        const char *tmp = state->ptr + !!*state->ptr;
 {
        size_t mb;
        const char *tmp = state->ptr + !!*state->ptr;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        /* is there actually a query to parse? */
        if (*state->ptr != '?') {
 
        /* is there actually a query to parse? */
        if (*state->ptr != '?') {
@@ -1045,7 +1027,7 @@ static const char *parse_query(struct parse_state *state)
 
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
 
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse query; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
                                                "Failed to parse query; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
@@ -1101,7 +1083,6 @@ static const char *parse_fragment(struct parse_state *state)
 {
        size_t mb;
        const char *tmp;
 {
        size_t mb;
        const char *tmp;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        /* is there actually a fragment to parse? */
        if (*state->ptr != '#') {
 
        /* is there actually a fragment to parse? */
        if (*state->ptr != '#') {
@@ -1116,7 +1097,7 @@ static const char *parse_fragment(struct parse_state *state)
                switch (*state->ptr) {
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
                switch (*state->ptr) {
                case '%':
                        if (state->ptr[1] != '%' && (state->end - state->ptr <= 2 || !isxdigit(*(state->ptr+1)) || !isxdigit(*(state->ptr+2)))) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               php_error_docref(NULL, E_WARNING,
                                                "Failed to parse fragment; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
                                                "Failed to parse fragment; invalid percent encoding at pos %u in '%s'",
                                                (unsigned) (state->ptr - tmp), tmp);
                                return NULL;
@@ -1216,7 +1197,7 @@ static const char *parse_scheme(struct parse_state *state)
        return state->ptr = tmp;
 }
 
        return state->ptr = tmp;
 }
 
-php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags TSRMLS_DC)
+php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags)
 {
        size_t maxlen = 3 * len;
        struct parse_state *state = ecalloc(1, sizeof(*state) + maxlen);
 {
        size_t maxlen = 3 * len;
        struct parse_state *state = ecalloc(1, sizeof(*state) + maxlen);
@@ -1225,10 +1206,9 @@ php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags T
        state->ptr = str;
        state->flags = flags;
        state->maxlen = maxlen;
        state->ptr = str;
        state->flags = flags;
        state->maxlen = maxlen;
-       TSRMLS_SET_CTX(state->ts);
 
        if (!parse_scheme(state)) {
 
        if (!parse_scheme(state)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse URL scheme: '%s'", state->ptr);
+               php_error_docref(NULL, E_WARNING, "Failed to parse URL scheme: '%s'", state->ptr);
                efree(state);
                return NULL;
        }
                efree(state);
                return NULL;
        }
@@ -1239,13 +1219,13 @@ php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags T
        }
 
        if (!parse_query(state)) {
        }
 
        if (!parse_query(state)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse URL query: '%s'", state->ptr);
+               php_error_docref(NULL, E_WARNING, "Failed to parse URL query: '%s'", state->ptr);
                efree(state);
                return NULL;
        }
 
        if (!parse_fragment(state)) {
                efree(state);
                return NULL;
        }
 
        if (!parse_fragment(state)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse URL fragment: '%s'", state->ptr);
+               php_error_docref(NULL, E_WARNING, "Failed to parse URL fragment: '%s'", state->ptr);
                efree(state);
                return NULL;
        }
                efree(state);
                return NULL;
        }
@@ -1261,35 +1241,35 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpUrl, __construct)
 {
        zval *new_url = NULL, *old_url = NULL;
 PHP_METHOD(HttpUrl, __construct)
 {
        zval *new_url = NULL, *old_url = NULL;
-       long flags = PHP_HTTP_URL_FROM_ENV;
+       zend_long flags = PHP_HTTP_URL_FROM_ENV;
        zend_error_handling zeh;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!z!l", &old_url, &new_url, &flags), invalid_arg, return);
 
        zend_error_handling zeh;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!z!l", &old_url, &new_url, &flags), invalid_arg, return);
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh);
        {
                php_http_url_t *res_purl, *new_purl = NULL, *old_purl = NULL;
 
                if (new_url) {
        {
                php_http_url_t *res_purl, *new_purl = NULL, *old_purl = NULL;
 
                if (new_url) {
-                       new_purl = php_http_url_from_zval(new_url, flags TSRMLS_CC);
+                       new_purl = php_http_url_from_zval(new_url, flags);
                        if (!new_purl) {
                        if (!new_purl) {
-                               zend_restore_error_handling(&zeh TSRMLS_CC);
+                               zend_restore_error_handling(&zeh);
                                return;
                        }
                }
                if (old_url) {
                                return;
                        }
                }
                if (old_url) {
-                       old_purl = php_http_url_from_zval(old_url, flags TSRMLS_CC);
+                       old_purl = php_http_url_from_zval(old_url, flags);
                        if (!old_purl) {
                                if (new_purl) {
                                        php_http_url_free(&new_purl);
                                }
                        if (!old_purl) {
                                if (new_purl) {
                                        php_http_url_free(&new_purl);
                                }
-                               zend_restore_error_handling(&zeh TSRMLS_CC);
+                               zend_restore_error_handling(&zeh);
                                return;
                        }
                }
 
                                return;
                        }
                }
 
-               res_purl = php_http_url_mod(old_purl, new_purl, flags TSRMLS_CC);
-               php_http_url_to_struct(res_purl, getThis() TSRMLS_CC);
+               res_purl = php_http_url_mod(old_purl, new_purl, flags);
+               php_http_url_to_struct(res_purl, getThis());
 
                php_http_url_free(&res_purl);
                if (old_purl) {
 
                php_http_url_free(&res_purl);
                if (old_purl) {
@@ -1299,7 +1279,7 @@ PHP_METHOD(HttpUrl, __construct)
                        php_http_url_free(&new_purl);
                }
        }
                        php_http_url_free(&new_purl);
                }
        }
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_restore_error_handling(&zeh);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_mod, 0, 0, 1)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_mod, 0, 0, 1)
@@ -1309,19 +1289,19 @@ ZEND_END_ARG_INFO();
 PHP_METHOD(HttpUrl, mod)
 {
        zval *new_url = NULL;
 PHP_METHOD(HttpUrl, mod)
 {
        zval *new_url = NULL;
-       long flags = PHP_HTTP_URL_JOIN_PATH | PHP_HTTP_URL_JOIN_QUERY;
+       zend_long flags = PHP_HTTP_URL_JOIN_PATH | PHP_HTTP_URL_JOIN_QUERY;
        zend_error_handling zeh;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!|l", &new_url, &flags), invalid_arg, return);
 
        zend_error_handling zeh;
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!|l", &new_url, &flags), invalid_arg, return);
 
-       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh TSRMLS_CC);
+       zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh);
        {
                php_http_url_t *new_purl = NULL, *old_purl = NULL;
 
                if (new_url) {
        {
                php_http_url_t *new_purl = NULL, *old_purl = NULL;
 
                if (new_url) {
-                       new_purl = php_http_url_from_zval(new_url, flags TSRMLS_CC);
+                       new_purl = php_http_url_from_zval(new_url, flags);
                        if (!new_purl) {
                        if (!new_purl) {
-                               zend_restore_error_handling(&zeh TSRMLS_CC);
+                               zend_restore_error_handling(&zeh);
                                return;
                        }
                }
                                return;
                        }
                }
@@ -1329,10 +1309,10 @@ PHP_METHOD(HttpUrl, mod)
                if ((old_purl = php_http_url_from_struct(HASH_OF(getThis())))) {
                        php_http_url_t *res_purl;
 
                if ((old_purl = php_http_url_from_struct(HASH_OF(getThis())))) {
                        php_http_url_t *res_purl;
 
-                       ZVAL_OBJVAL(return_value, zend_objects_clone_obj(getThis() TSRMLS_CC), 0);
+                       ZVAL_OBJ(return_value, zend_objects_clone_obj(getThis()));
 
 
-                       res_purl = php_http_url_mod(old_purl, new_purl, flags TSRMLS_CC);
-                       php_http_url_to_struct(res_purl, return_value TSRMLS_CC);
+                       res_purl = php_http_url_mod(old_purl, new_purl, flags);
+                       php_http_url_to_struct(res_purl, return_value);
 
                        php_http_url_free(&res_purl);
                        php_http_url_free(&old_purl);
 
                        php_http_url_free(&res_purl);
                        php_http_url_free(&old_purl);
@@ -1341,7 +1321,7 @@ PHP_METHOD(HttpUrl, mod)
                        php_http_url_free(&new_purl);
                }
        }
                        php_http_url_free(&new_purl);
                }
        }
-       zend_restore_error_handling(&zeh TSRMLS_CC);
+       zend_restore_error_handling(&zeh);
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_toString, 0, 0, 0)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_toString, 0, 0, 0)
@@ -1357,7 +1337,7 @@ PHP_METHOD(HttpUrl, toString)
 
                        php_http_url_to_string(purl, &str, &len, 0);
                        php_http_url_free(&purl);
 
                        php_http_url_to_string(purl, &str, &len, 0);
                        php_http_url_free(&purl);
-                       RETURN_STRINGL(str, len, 0);
+                       RETURN_STR(php_http_cs2zs(str, len));
                }
        }
        RETURN_EMPTY_STRING();
                }
        }
        RETURN_EMPTY_STRING();
@@ -1375,7 +1355,7 @@ PHP_METHOD(HttpUrl, toArray)
 
        /* strip any non-URL properties */
        purl = php_http_url_from_struct(HASH_OF(getThis()));
 
        /* strip any non-URL properties */
        purl = php_http_url_from_struct(HASH_OF(getThis()));
-       php_http_url_to_struct(purl, return_value TSRMLS_CC);
+       php_http_url_to_struct(purl, return_value);
        php_http_url_free(&purl);
 }
 
        php_http_url_free(&purl);
 }
 
index fb9193200c567e2d0a227f252c2c20f4b09ba7c4..df35a9e3a690eaab0748736076c99541c7506772 100644 (file)
@@ -56,25 +56,22 @@ typedef struct php_http_url {
        char *fragment;
 } php_http_url_t;
 
        char *fragment;
 } php_http_url_t;
 
-PHP_HTTP_API php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags TSRMLS_DC);
-/* deprecated */
-PHP_HTTP_API void php_http_url(int flags, const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC);
-/* use this instead */
-PHP_HTTP_API php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_url_t *new_url, unsigned flags TSRMLS_DC);
+PHP_HTTP_API php_http_url_t *php_http_url_parse(const char *str, size_t len, unsigned flags);
+PHP_HTTP_API php_http_url_t *php_http_url_mod(const php_http_url_t *old_url, const php_http_url_t *new_url, unsigned flags);
 PHP_HTTP_API php_http_url_t *php_http_url_copy(const php_http_url_t *url, zend_bool persistent);
 PHP_HTTP_API php_http_url_t *php_http_url_from_struct(HashTable *ht);
 PHP_HTTP_API php_http_url_t *php_http_url_copy(const php_http_url_t *url, zend_bool persistent);
 PHP_HTTP_API php_http_url_t *php_http_url_from_struct(HashTable *ht);
-PHP_HTTP_API php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags TSRMLS_DC);
-PHP_HTTP_API HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct TSRMLS_DC);
+PHP_HTTP_API php_http_url_t *php_http_url_from_zval(zval *value, unsigned flags);
+PHP_HTTP_API HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct);
 PHP_HTTP_API char *php_http_url_to_string(const php_http_url_t *url, char **url_str, size_t *url_len, zend_bool persistent);
 PHP_HTTP_API void php_http_url_free(php_http_url_t **url);
 
 
 PHP_HTTP_API char *php_http_url_to_string(const php_http_url_t *url, char **url_str, size_t *url_len, zend_bool persistent);
 PHP_HTTP_API void php_http_url_free(php_http_url_t **url);
 
 
-PHP_HTTP_API STATUS php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC);
-PHP_HTTP_API STATUS php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len TSRMLS_DC);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len);
+PHP_HTTP_API ZEND_RESULT_CODE php_http_url_encode_hash_ex(HashTable *hash, php_http_buffer_t *qstr, const char *arg_sep_str, size_t arg_sep_len, const char *val_sep_str, size_t val_sep_len, const char *pre_encoded_str, size_t pre_encoded_len);
 
 
-static inline void php_http_url_argsep(const char **str, size_t *len TSRMLS_DC)
+static inline void php_http_url_argsep(const char **str, size_t *len)
 {
 {
-       if (SUCCESS != php_http_ini_entry(ZEND_STRL("arg_separator.output"), str, len, 0 TSRMLS_CC) || !*len) {
+       if (SUCCESS != php_http_ini_entry(ZEND_STRL("arg_separator.output"), str, len, 0) || !*len) {
                *str = PHP_HTTP_URL_ARGSEP;
                *len = lenof(PHP_HTTP_URL_ARGSEP);
        }
                *str = PHP_HTTP_URL_ARGSEP;
                *len = lenof(PHP_HTTP_URL_ARGSEP);
        }
index f4fcfc85367417dee7cb8f711fe39d89f18250b3..0579467fc1e9cb9a79e5f015582c8dbd1c24e382 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "php_http_api.h"
 
 
 #include "php_http_api.h"
 
-php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor TSRMLS_DC)
+php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor)
 {
        if (!v) {
                v = emalloc(sizeof(*v));
 {
        if (!v) {
                v = emalloc(sizeof(*v));
@@ -24,7 +24,7 @@ php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major,
        return v;
 }
 
        return v;
 }
 
-php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str TSRMLS_DC)
+php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str)
 {
        long major, minor;
        char separator = 0, *stop = NULL;
 {
        long major, minor;
        char separator = 0, *stop = NULL;
@@ -60,7 +60,7 @@ php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *st
        return NULL;
 }
 
        return NULL;
 }
 
-void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post TSRMLS_DC)
+void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post)
 {
        *len = spprintf(str, 0, "%s%u.%u%s", pre ? pre : "", v->major, v->minor, post ? post : "");
 }
 {
        *len = spprintf(str, 0, "%s%u.%u%s", pre ? pre : "", v->major, v->minor, post ? post : "");
 }
index 40b833eedef3f69ca2542db5342723291f823d8f..d45d57bfdff9d9288dfa6e60f99a50569f64ece8 100644 (file)
@@ -18,9 +18,9 @@ typedef struct php_http_version {
        unsigned minor;
 } php_http_version_t;
 
        unsigned minor;
 } php_http_version_t;
 
-PHP_HTTP_API php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor TSRMLS_DC);
+PHP_HTTP_API php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor);
 PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str TSRMLS_DC);
 PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str TSRMLS_DC);
-PHP_HTTP_API void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post TSRMLS_DC);
+PHP_HTTP_API void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post);
 PHP_HTTP_API void php_http_version_dtor(php_http_version_t *v);
 PHP_HTTP_API void php_http_version_free(php_http_version_t **v);
 
 PHP_HTTP_API void php_http_version_dtor(php_http_version_t *v);
 PHP_HTTP_API void php_http_version_free(php_http_version_t **v);