fixes for windows and 5.3 compatibility
authorAnatoliy Belsky <ab@php.net>
Sun, 17 Jun 2012 16:29:07 +0000 (16:29 +0000)
committerAnatoliy Belsky <ab@php.net>
Sun, 17 Jun 2012 16:29:07 +0000 (16:29 +0000)
17 files changed:
config.w32 [new file with mode: 0644]
php_http_api.h
php_http_client.c
php_http_client_datashare.c
php_http_client_pool.c
php_http_cookie.c
php_http_curl_client.c
php_http_curl_client_datashare.c
php_http_curl_client_pool.c
php_http_encoding.c
php_http_encoding.h
php_http_env_response.c
php_http_message_body.c
php_http_message_parser.c
php_http_object.c
php_http_params.c
php_http_property_proxy.c

diff --git a/config.w32 b/config.w32
new file mode 100644 (file)
index 0000000..8e2c1ac
--- /dev/null
@@ -0,0 +1,116 @@
+// config.w32 for pecl/http\r
+// $Id$\r
+\r
+ARG_ENABLE("http", "whether to enable extended HTTP support", "no");\r
+\r
+function check_for_main_ext(ext, header)\r
+{\r
+       if (!header) {\r
+               header = "php_"+ ext +".h";\r
+       }\r
+\r
+       /* When in configure, we're always in the root of PHP source */\r
+       var ext_path = "ext\\" + ext;\r
+       \r
+       STDOUT.Write("Checking for ext/"+ ext +" ...  ");\r
+\r
+       if (FSO.FileExists(ext_path + "\\" + header)) {\r
+               STDOUT.WriteLine(ext_path);\r
+               return ext_path;\r
+       }\r
+\r
+       STDOUT.WriteLine("<not found>");\r
+       return false;\r
+}\r
+\r
+function check_for_pecl_ext(ext, header)\r
+{\r
+       if (!header) {\r
+               header = "php_"+ ext +".h";\r
+       }\r
+       \r
+       var g;\r
+       var s = ext +"\\"+ header;\r
+       \r
+       STDOUT.Write("Checking for pecl/"+ ext +" ...  ");\r
+       if (    (g = glob(configure_module_dirname +"\\..\\"+ s)) ||\r
+                       (g = glob(configure_module_dirname +"\\..\\..\\..\\pecl\\"+ s))) {\r
+               var f = g[0].substr(0, g[0].length - header.length - 1);\r
+               STDOUT.WriteLine(f);\r
+               return f;\r
+       }\r
+       STDOUT.WriteLine("<not found>");\r
+       return false;\r
+}\r
+\r
+if (PHP_HTTP != "no") {\r
+\r
+       EXTENSION("http",\r
+               "php_http_buffer.c php_http.c php_http_client.c php_http_curl_client.c php_http_client_datashare.c " +\r
+               "php_http_curl_client_datashare.c php_http_client_factory.c php_http_client_interface.c " +\r
+               "php_http_client_pool.c php_http_curl_client_pool.c php_http_client_request.c " +\r
+               "php_http_client_response.c php_http_cookie.c php_http_curl.c php_http_encoding.c " +\r
+               "php_http_env.c php_http_env_request.c php_http_env_response.c php_http_etag.c " +\r
+               "php_http_exception.c php_http_filter.c php_http_header_parser.c php_http_headers.c " +\r
+               "php_http_info.c php_http_message_body.c php_http_message.c php_http_message_parser.c " +\r
+               "php_http_misc.c php_http_negotiate.c php_http_object.c php_http_params.c " +\r
+               "php_http_persistent_handle.c php_http_property_proxy.c php_http_querystring.c " +\r
+               "php_http_resource_factory.c php_http_strlist.c php_http_url.c php_http_version.c");\r
+\r
+       AC_DEFINE("HAVE_HTTP", 1, "Have extended HTTP support");\r
+       AC_DEFINE("HTTP_SHARED_DEPS", 1, "Depend on shared extensions");\r
+       \r
+       AC_DEFINE("HAVE_GETHOSTNAME", 1);\r
+       AC_DEFINE("HAVE_GETSERVBYPORT", 1);\r
+       AC_DEFINE("HAVE_GETSERVBYNAME", 1);\r
+       \r
+       if (PHP_DEBUG != "no") {\r
+               ADD_FLAG("CFLAGS_HTTP", "/W3");\r
+       }\r
+       \r
+       if (CHECK_HEADER_ADD_INCLUDE('zlib.h', 'CFLAGS_HTTP', '..\\zlib;' + php_usual_include_suspects)) {\r
+               AC_DEFINE('HTTP_HAVE_ZLIB', 1, "Have zlib library");\r
+               ADD_FLAG("LDFLAGS_HTTP", "/FORCE:MULTIPLE");\r
+       } else {\r
+               WARNING("zlib encoding functions not enabled; libraries and headers not found");\r
+       }\r
+       \r
+       if (typeof(PHP_HASH) != "undefined" && PHP_HASH != "no") {\r
+               var f;\r
+               \r
+               if ((f = check_for_pecl_ext("hash")) || (f = check_for_main_ext("hash"))) {\r
+                       ADD_FLAG("CFLAGS_HTTP", '/I "' + f + '" /DHTTP_HAVE_PHP_HASH_H=1');\r
+                       ADD_EXTENSION_DEP("http", "hash", true);\r
+               }\r
+       }\r
+       \r
+       if (PHP_SESSION != "no") {\r
+               ADD_EXTENSION_DEP("http", "session", true);\r
+       }\r
+       \r
+       if (PHP_ICONV != "no") {\r
+               ADD_EXTENSION_DEP("http", "iconv", true);\r
+       }\r
+       \r
+       CURL_LIB="libcurl_a.lib;libcurl.lib;" + (PHP_DEBUG != "no" ? "libcurld.lib":"libcurl.lib");\r
+       if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") &&\r
+                       CHECK_HEADER_ADD_INCLUDE("openssl/crypto.h", "CFLAGS_HTTP") &&\r
+                       CHECK_LIB(CURL_LIB, "http", PHP_HTTP) &&\r
+                       CHECK_LIB("ssleay32.lib", "http", PHP_HTTP) &&\r
+                       CHECK_LIB("libeay32.lib", "http", PHP_HTTP) &&\r
+                       CHECK_LIB("zlib.lib;zlib_a.lib", "http", PHP_HTTP) &&\r
+                       CHECK_LIB("winmm.lib", "http", PHP_HTTP)) {\r
+               AC_DEFINE("PHP_HTTP_HAVE_CURL", 1, "Have CURL library");\r
+               AC_DEFINE("PHP_HTTP_HAVE_SSL", 1, "Have SSL");\r
+               AC_DEFINE("PHP_HAVE_CURL_MULTI_STRERROR", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_SHARE_STRERROR", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_EASY_STRERROR", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_EASY_RESET", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_GETFORMDATA", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_FORMGET", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_MULTI_SETOPT", 1, "");\r
+               AC_DEFINE("PHP_HAVE_CURL_MULTI_TIMEOUT", 1, "");\r
+       } else {\r
+               WARNING("curl convenience functions not enabled; libraries and headers not found");\r
+       }\r
+}\r
index 72ebf4dc49ebd8cf9113dd71b08bc08d25c7e39a..fbfea28a02b85593d2832210c61933ee7e2ddaaf 100644 (file)
@@ -17,7 +17,9 @@
 #include "config.h"
 #endif
 
+#ifndef PHP_WIN32
 #include <php_config.h>
+#endif
 #include <php.h>
 #include <SAPI.h>
 
 
 #include <zend_interfaces.h>
 
-#if defined(PHP_WIN32)
-#      if defined(PHP_HTTP_EXPORTS)
-#              define PHP_HTTP_API __declspec(dllexport)
-#      elif defined(COMPILE_DL_HTTP)
-#              define PHP_HTTP_API __declspec(dllimport)
-#      else
-#              define PHP_HTTP_API
-#      endif
+#ifdef PHP_WIN32
+# define PHP_HTTP_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define PHP_HTTP_API __attribute__ ((visibility("default")))
 #else
-#      define PHP_HTTP_API
+# define PHP_HTTP_API
 #endif
 
 /* make functions that return SUCCESS|FAILURE more obvious */
index f131136a1d0222021cd137e85d21f91f7b7b0fca..de09590ffd23d2a1b1f968cc9b82f11d5dc00a6d 100644 (file)
@@ -296,8 +296,11 @@ zend_object_value php_http_client_object_new_ex(zend_class_entry *ce, php_http_c
 
        o = ecalloc(1, sizeof(*o));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
-
+#endif
        ov.handle = zend_objects_store_put(o, NULL, php_http_client_object_free, NULL TSRMLS_CC);
        ov.handlers = &php_http_client_object_handlers;
 
index 09d568ff939debbf93c51ac9e1b51fe17502db21..2046db104957efda7a6a1b115ae3c03b0467aec7 100644 (file)
@@ -147,7 +147,11 @@ PHP_HTTP_BEGIN_ARGS(detach, 1)
        PHP_HTTP_ARG_OBJ(http\\Client, client, 0)
 PHP_HTTP_END_ARGS;
 
-static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *literal_key TSRMLS_DC);
+static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value
+#if PHP_VERSION_ID >= 50400
+, const zend_literal *literal_key 
+#endif
+TSRMLS_DC);
 
 static zend_class_entry *php_http_client_datashare_class_entry;
 
@@ -201,7 +205,11 @@ zend_object_value php_http_client_datashare_object_new_ex(zend_class_entry *ce,
 
        o = ecalloc(1, sizeof(*o));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        ov.handle = zend_objects_store_put(o, NULL, php_http_client_datashare_object_free, NULL TSRMLS_CC);
        ov.handlers = &php_http_client_datashare_object_handlers;
@@ -226,7 +234,11 @@ void php_http_client_datashare_object_free(void *object TSRMLS_DC)
        efree(o);
 }
 
-static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *literal_key TSRMLS_DC)
+static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value
+#if PHP_VERSION_ID >= 50400
+, const zend_literal *literal_key 
+#endif
+TSRMLS_DC)
 {
        zend_property_info *pi;
 
@@ -250,10 +262,18 @@ static void php_http_client_datashare_object_write_prop(zval *object, zval *memb
                }
        }
 
-       zend_get_std_object_handlers()->write_property(object, member, value, literal_key TSRMLS_CC);
+       zend_get_std_object_handlers()->write_property(object, member, value
+#if PHP_VERSION_ID >= 50400
+       , literal_key 
+#endif
+       TSRMLS_CC);
 }
 
-static zval **php_http_client_datashare_object_get_prop_ptr(zval *object, zval *member, const zend_literal *literal_key TSRMLS_DC)
+static zval **php_http_client_datashare_object_get_prop_ptr(zval *object, zval *member
+#if PHP_VERSION_ID >= 50400
+, const zend_literal *literal_key
+#endif
+TSRMLS_DC)
 {
        zend_property_info *pi;
 
@@ -261,7 +281,11 @@ static zval **php_http_client_datashare_object_get_prop_ptr(zval *object, zval *
                return &php_http_property_proxy_init(NULL, object, member, NULL TSRMLS_CC)->myself;
        }
 
-       return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member, literal_key TSRMLS_CC);
+       return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member
+#if PHP_VERSION_ID >= 50400
+       , literal_key
+#endif
+       TSRMLS_CC);
 }
 
 
index 5eba4c7db7959b909cc8641ae17c0a04b55a62f7..cb98d43f96b9f308123ac2fb7d8771024aa0a6b6 100644 (file)
@@ -321,7 +321,11 @@ zend_object_value php_http_client_pool_object_new_ex(zend_class_entry *ce, php_h
 
        o = ecalloc(1, sizeof(php_http_client_pool_object_t));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (!(o->pool = p)) {
                o->pool = php_http_client_pool_init(NULL, &php_http_client_pool_user_ops, NULL, NULL TSRMLS_CC);
index 6908d386247e4b09de79af5b3e4618beb8887ffe..5b78abbe0dd161d9595839f14d88bbff065b47f8 100644 (file)
@@ -463,7 +463,11 @@ zend_object_value php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_c
 
        o = ecalloc(sizeof(*o), 1);
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (list) {
                o->list = list;
index 97b04a229200e6bf70bc0d4a1e96dc93ae77c864..d83bd5a9d24b2b519bf2b3a7f21bc91e4552dde7 100644 (file)
@@ -1307,7 +1307,11 @@ zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_h
 
        o = ecalloc(1, sizeof(php_http_client_object_t));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (!(o->client = r)) {
                o->client = php_http_client_init(NULL, &php_http_curl_client_ops, NULL, NULL TSRMLS_CC);
index cc370bad0f2817ed639a6eb89288d4196384bbcc..11856be3d36d81e255d03a98ccc45b3e768d3251 100644 (file)
@@ -181,7 +181,11 @@ zend_object_value php_http_curl_client_datashare_object_new_ex(zend_class_entry
 
        o = ecalloc(1, sizeof(*o));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (share) {
                o->share = share;
index ea1bace5f1efacd9b6f1b02345e37a84cd073e32..21d33144c6ae8abd78b57229495916bb0ba396cc 100644 (file)
@@ -510,7 +510,11 @@ zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce,
 
        o = ecalloc(1, sizeof(php_http_client_pool_object_t));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (!(o->pool = p)) {
                o->pool = php_http_client_pool_init(NULL, &php_http_curl_client_pool_ops, NULL, NULL TSRMLS_CC);
index 4a71c80074d24f1ea902a641df09810c13653312..c84c30981277d7f478a83e2330da97a88dfb555b 100644 (file)
@@ -959,7 +959,11 @@ zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, p
 
        o = ecalloc(1, sizeof(*o));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (ptr) {
                *ptr = o;
index 24d014664a0abb9b9128cb1340206c3ccee92e03..84dfac0d4013bfef598ad131f4c5d8ac8041b158 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef PHP_HTTP_ENCODING_H
 #define PHP_HTTP_ENCODING_H
 
+#include <zlib.h>
+
 extern PHP_MINIT_FUNCTION(http_encoding);
 extern PHP_RINIT_FUNCTION(http_encoding);
 extern PHP_RSHUTDOWN_FUNCTION(http_encoding);
index 5316bedcff50241520eb4bb0c3671f538f6043a5..c3cf80b891a4bd7a6fd37144e7f04863ad0192b1 100644 (file)
@@ -182,12 +182,14 @@ static size_t output(void *context, char *buf, size_t len TSRMLS_DC)
        /*      we really only need to flush when throttling is enabled,
                because we push the data as fast as possible anyway if not */
        if (r->throttle.delay >= PHP_HTTP_DIFFSEC) {
+#if PHP_VERSION_ID >= 50400
                if (php_output_get_level(TSRMLS_C)) {
                        php_output_flush_all(TSRMLS_C);
                }
                if (!(php_output_get_status(TSRMLS_C) & PHP_OUTPUT_IMPLICITFLUSH)) {
                        sapi_flush(TSRMLS_C);
                }
+#endif
                php_http_sleep(r->throttle.delay);
        }
        return len;
@@ -196,8 +198,8 @@ 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)
 static STATUS php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len)
 {
-       TSRMLS_FETCH_FROM_CTX(r->ts);
        size_t chunk = r->throttle.chunk ? r->throttle.chunk : PHP_HTTP_SENDBUF_SIZE;
+       TSRMLS_FETCH_FROM_CTX(r->ts);
 
        if (r->content.encoder) {
                char *enc_str = NULL;
index aeadb1804065a476406b62056fda7448712d8fca..9d0f2263e856f7ca1d4dce2d162d223484cbe410 100644 (file)
@@ -111,8 +111,8 @@ PHP_HTTP_API const char *php_http_message_body_boundary(php_http_message_body_t
 
 PHP_HTTP_API char *php_http_message_body_etag(php_http_message_body_t *body)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
        const php_stream_statbuf *ssb = php_http_message_body_stat(body);
+       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        /* real file or temp buffer ? */
        if (ssb && ssb->sb.st_mtime) {
@@ -134,8 +134,8 @@ PHP_HTTP_API char *php_http_message_body_etag(php_http_message_body_t *body)
 
 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)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
        php_stream *s = php_http_message_body_stream(body);
+       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_stream_seek(s, offset, SEEK_SET);
        if (!forlen) {
@@ -146,8 +146,8 @@ PHP_HTTP_API void php_http_message_body_to_string(php_http_message_body_t *body,
 
 PHP_HTTP_API void php_http_message_body_to_stream(php_http_message_body_t *body, php_stream *dst, off_t offset, size_t forlen)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
        php_stream *s = php_http_message_body_stream(body);
+       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        php_stream_seek(s, offset, SEEK_SET);
        if (!forlen) {
@@ -158,9 +158,9 @@ PHP_HTTP_API void php_http_message_body_to_stream(php_http_message_body_t *body,
 
 PHP_HTTP_API void 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)
 {
-       TSRMLS_FETCH_FROM_CTX(body->ts);
        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);
 
@@ -264,10 +264,13 @@ PHP_HTTP_API STATUS php_http_message_body_add_form_field(php_http_message_body_t
 
 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 *path, php_stream *in)
 {
-       char *safe_name, *path_dup = estrdup(path);
+       char *safe_name, *path_dup = estrdup(path), *bname;
+       size_t bname_len;
        TSRMLS_FETCH_FROM_CTX(body->ts);
 
        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); 
 
        BOUNDARY_OPEN(body);
        php_http_message_body_appendf(
@@ -276,7 +279,7 @@ PHP_HTTP_API STATUS php_http_message_body_add_form_file(php_http_message_body_t
                "Content-Transfer-Encoding: binary" PHP_HTTP_CRLF
                "Content-Type: %s" PHP_HTTP_CRLF
                PHP_HTTP_CRLF,
-               safe_name, basename(path_dup), ctype
+               safe_name, bname, ctype
        );
        php_stream_copy_to_stream_ex(in, php_http_message_body_stream(body), PHP_STREAM_COPY_ALL, NULL);
        BOUNDARY_CLOSE(body);
@@ -609,7 +612,11 @@ zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_
 
        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);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (ptr) {
                *ptr = o;
index 5acf66f76529f18d20cce5fdcd40f6a9465fe8b0..ecdfe37b51cdb3bba4e1c6c962c8a3649543cc39 100644 (file)
@@ -169,10 +169,10 @@ PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse_strea
 
 PHP_HTTP_API php_http_message_parser_state_t php_http_message_parser_parse(php_http_message_parser_t *parser, php_http_buffer_t *buffer, unsigned flags, php_http_message_t **message)
 {
-       TSRMLS_FETCH_FROM_CTX(parser->ts);
        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 0
index c278e6bc08b9b75c700b198bf386173154ffcf49..f85960f6acbb3cc3979f2e4a121313d1ac763642 100644 (file)
@@ -98,7 +98,11 @@ zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, ph
 
        o = ecalloc(1, sizeof(php_http_object_t));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (ptr) {
                *ptr = o;
index 76313a0f7346ecbfdffe67b8f43e1efab945c94b..da78303d3e0affa311b0d3444ad0fa8b1a15b27e 100644 (file)
@@ -16,11 +16,12 @@ static php_http_params_token_t def_param_sep = {",", 1}, *def_param_sep_ptr[] =
 static php_http_params_token_t def_arg_sep = {";", 1}, *def_arg_sep_ptr[] = {&def_arg_sep, NULL};
 static php_http_params_token_t def_val_sep = {"=", 1}, *def_val_sep_ptr[] = {&def_val_sep, NULL};
 static php_http_params_opts_t def_opts = {
-       .param = def_param_sep_ptr,
-       .arg = def_arg_sep_ptr,
-       .val = def_val_sep_ptr,
-       .defval = NULL,
-       .flags = PHP_HTTP_PARAMS_DEFAULT
+       {{0},0},
+       def_param_sep_ptr,
+       def_arg_sep_ptr,
+       def_val_sep_ptr,
+       NULL,
+       PHP_HTTP_PARAMS_DEFAULT
 };
 
 PHP_HTTP_API php_http_params_opts_t *php_http_params_opts_default_get(php_http_params_opts_t *opts)
@@ -146,7 +147,12 @@ static void sanitize_dimension(zval *zv TSRMLS_DC)
 
        if (zend_hash_num_elements(Z_ARRVAL_P(arr))) {
                zval_dtor(zv);
+#if PHP_VERSION_ID >= 50400
                ZVAL_COPY_VALUE(zv, arr);
+#else
+       zv->value = arr->value;
+       Z_TYPE_P(zv) = Z_TYPE_P(arr);
+#endif
                FREE_ZVAL(arr);
        } else {
                zval_ptr_dtor(&arr);
@@ -392,7 +398,12 @@ static void push_param(HashTable *params, php_http_params_state_t *state, const
 
                                MAKE_STD_ZVAL(val);
                                if (opts->defval) {
+#if PHP_VERSION_ID >= 50400
                                        ZVAL_COPY_VALUE(val, opts->defval);
+#else
+                                       val->value = opts->defval->value;
+                                       Z_TYPE_P(val) = Z_TYPE_P(opts->defval);
+#endif
                                        zval_copy_ctor(val);
                                } else {
                                        ZVAL_TRUE(val);
@@ -797,14 +808,11 @@ PHP_METHOD(HttpParams, __construct)
                                                zcopy = php_http_ztyp(IS_STRING, zparams);
                                                if (Z_STRLEN_P(zcopy)) {
                                                        php_http_params_opts_t opts = {
-                                                               .input = {
-                                                                       .str = Z_STRVAL_P(zcopy),
-                                                                       .len = Z_STRLEN_P(zcopy)
-                                                               },
-                                                               .param = php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0 TSRMLS_CC) TSRMLS_CC),
-                                                               .arg = php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0 TSRMLS_CC) TSRMLS_CC),
-                                                               .val = php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0 TSRMLS_CC) TSRMLS_CC),
-                                                               .flags = flags
+                                                               {Z_STRVAL_P(zcopy), Z_STRLEN_P(zcopy)},
+                                                               php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0 TSRMLS_CC) TSRMLS_CC),
+                                                               php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0 TSRMLS_CC) TSRMLS_CC),
+                                                               php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0 TSRMLS_CC) TSRMLS_CC),
+                                                               NULL, flags
                                                        };
 
                                                        MAKE_STD_ZVAL(zparams);
index f4d352300cee50da02405c5ece530d0f3f568600..781c0c0ccc5c60e67ed8d579bc93d7406b46efbd 100644 (file)
@@ -91,7 +91,11 @@ zend_object_value php_http_property_proxy_object_new_ex(zend_class_entry *ce, ph
 
        o = ecalloc(1, sizeof(*o));
        zend_object_std_init((zend_object *) o, ce TSRMLS_CC);
+#if PHP_VERSION_ID < 50339
+       zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*));
+#else
        object_properties_init((zend_object *) o, ce);
+#endif
 
        if (ptr) {
                *ptr = o;