hack PHP_5_4 compatibility into v1
authorMichael Wallner <mike@php.net>
Fri, 17 Feb 2012 21:13:24 +0000 (21:13 +0000)
committerMichael Wallner <mike@php.net>
Fri, 17 Feb 2012 21:13:24 +0000 (21:13 +0000)
19 files changed:
http_api.c
http_cache_api.c
http_deflatestream_object.c
http_encoding_api.c
http_inflatestream_object.c
http_message_api.c
http_message_object.c
http_querystring_object.c
http_request_info.c
http_request_object.c
http_requestdatashare_object.c
http_requestpool_object.c
http_response_object.c
missing.h
php_http.h
php_http_api.h
php_http_std_defs.h
scripts/gen_curlinfo.php
tests/request_gzip.phpt

index 06cc43d6bfe63c0a3870bdf4815c5e58db75fd1c..aa5b97b88c056fe94be0f11311b06d2a98d24e3e 100644 (file)
@@ -253,16 +253,12 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                return FAILURE;
        }
 
                return FAILURE;
        }
 
-       if (
-#if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
-               (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_ACTIVE) &&
-               (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_HANDLER_FLUSHABLE) && 
-#else
-               !OG(ob_lock) &&
-#endif
+#ifndef PHP_OUTPUT_NEWAPI
+       if (!OG(ob_lock) &&
                !php_ob_handler_used("zlib output compression" TSRMLS_CC) && !php_ob_handler_used("ob_gzhandler" TSRMLS_CC)) {
                php_end_ob_buffers(0 TSRMLS_CC);
        }
                !php_ob_handler_used("zlib output compression" TSRMLS_CC) && !php_ob_handler_used("ob_gzhandler" TSRMLS_CC)) {
                php_end_ob_buffers(0 TSRMLS_CC);
        }
+#endif
 
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
 
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
@@ -286,7 +282,11 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
        if (HTTP_G->force_exit) {
                zend_bailout();
        } else {
        if (HTTP_G->force_exit) {
                zend_bailout();
        } else {
+#ifdef PHP_OUTPUT_NEWAPI
+               php_output_start_devnull(TSRMLS_C);
+#else
                php_ob_set_internal_handler(http_ob_blackhole, 4096, "blackhole", 0 TSRMLS_CC);
                php_ob_set_internal_handler(http_ob_blackhole, 4096, "blackhole", 0 TSRMLS_CC);
+#endif
        }
        
        return SUCCESS;
        }
        
        return SUCCESS;
index 4cc07b996da0e6fdb1d984b77bd13bf0b37af623..b6bc23714bd292882716ae66692118290b66095e 100644 (file)
@@ -182,13 +182,24 @@ PHP_HTTP_API STATUS _http_cache_etag(const char *etag, size_t etag_len,
 PHP_HTTP_API STATUS _http_start_ob_etaghandler(TSRMLS_D)
 {
        /* already running? */
 PHP_HTTP_API STATUS _http_start_ob_etaghandler(TSRMLS_D)
 {
        /* already running? */
+#ifdef PHP_OUTPUT_NEWAPI
+    STATUS rv;
+
+    if (php_output_handler_conflict(ZEND_STRL("ob_etaghandler"), ZEND_STRL("ob_etaghandler") TSRMLS_CC)) {
+        return FAILURE;
+    }
+#else
        if (php_ob_handler_used("ob_etaghandler" TSRMLS_CC)) {
                http_error(HE_WARNING, HTTP_E_RUNTIME, "ob_etaghandler can only be used once");
                return FAILURE;
        }
        if (php_ob_handler_used("ob_etaghandler" TSRMLS_CC)) {
                http_error(HE_WARNING, HTTP_E_RUNTIME, "ob_etaghandler can only be used once");
                return FAILURE;
        }
-       
+#endif
        HTTP_G->etag.started = 1;
        HTTP_G->etag.started = 1;
+#ifdef PHP_OUTPUT_NEWAPI
+    return php_output_start_internal(ZEND_STRL("ob_etaghandler"), _http_ob_etaghandler, HTTP_G->send.buffer_size, 0 TSRMLS_CC);
+#else
        return php_start_ob_buffer_named("ob_etaghandler", HTTP_G->send.buffer_size, 0 TSRMLS_CC);
        return php_start_ob_buffer_named("ob_etaghandler", HTTP_G->send.buffer_size, 0 TSRMLS_CC);
+#endif
 }
 
 PHP_HTTP_API zend_bool _http_interrupt_ob_etaghandler(TSRMLS_D)
 }
 
 PHP_HTTP_API zend_bool _http_interrupt_ob_etaghandler(TSRMLS_D)
index 22f5c049cf7921a32b2322f7dd8753cc65a9017f..6b0d472123af47888f171f098e58a4bbb2f5d071 100644 (file)
@@ -108,8 +108,8 @@ zend_object_value _http_deflatestream_object_new_ex(zend_class_entry *ce, http_e
        }
 
 #ifdef ZEND_ENGINE_2_4
        }
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
index 15fb5fd133e21b7a342c55b7d8eed48f8beee4a7..1d9b9163a31af614fda99c992818fe4ef40ed7a3 100644 (file)
@@ -46,10 +46,18 @@ PHP_MINIT_FUNCTION(http_encoding)
 PHP_RINIT_FUNCTION(http_encoding)
 {
        if (HTTP_G->send.inflate.start_auto) {
 PHP_RINIT_FUNCTION(http_encoding)
 {
        if (HTTP_G->send.inflate.start_auto) {
+#ifdef PHP_OUTPUT_NEWAPI
+               php_output_start_internal(ZEND_STRL("http inflate"), _http_ob_inflatehandler, HTTP_INFLATE_BUFFER_SIZE, 0 TSRMLS_CC);
+#else
                php_ob_set_internal_handler(_http_ob_inflatehandler, HTTP_INFLATE_BUFFER_SIZE, "http inflate", 0 TSRMLS_CC);
                php_ob_set_internal_handler(_http_ob_inflatehandler, HTTP_INFLATE_BUFFER_SIZE, "http inflate", 0 TSRMLS_CC);
+#endif
        }
        if (HTTP_G->send.deflate.start_auto) {
        }
        if (HTTP_G->send.deflate.start_auto) {
+#ifdef PHP_OUTPUT_NEWAPI
+               php_output_start_internal(ZEND_STRL("http deflate"), _http_ob_deflatehandler, HTTP_DEFLATE_BUFFER_SIZE, 0 TSRMLS_CC);
+#else
                php_ob_set_internal_handler(_http_ob_deflatehandler, HTTP_DEFLATE_BUFFER_SIZE, "http deflate", 0 TSRMLS_CC);
                php_ob_set_internal_handler(_http_ob_deflatehandler, HTTP_DEFLATE_BUFFER_SIZE, "http deflate", 0 TSRMLS_CC);
+#endif
        }
        return SUCCESS;
 }
        }
        return SUCCESS;
 }
@@ -161,10 +169,18 @@ PHP_HTTP_API const char *_http_encoding_dechunk(const char *encoded, size_t enco
 PHP_HTTP_API int _http_encoding_response_start(size_t content_length, zend_bool ignore_http_ohandler TSRMLS_DC)
 {
        int response = HTTP_G->send.deflate.response;
 PHP_HTTP_API int _http_encoding_response_start(size_t content_length, zend_bool ignore_http_ohandler TSRMLS_DC)
 {
        int response = HTTP_G->send.deflate.response;
+#ifdef PHP_OUTPUT_NEWAPI
+       int ohandler = php_output_handler_started(ZEND_STRL("ob_gzhandler") TSRMLS_CC) || php_output_handler_started(ZEND_STRL("zlib output compression") TSRMLS_CC);
+#else
        int ohandler = php_ob_handler_used("ob_gzhandler" TSRMLS_CC) || php_ob_handler_used("zlib output compression" TSRMLS_CC);
        int ohandler = php_ob_handler_used("ob_gzhandler" TSRMLS_CC) || php_ob_handler_used("zlib output compression" TSRMLS_CC);
+#endif
        
        if (!ohandler && !ignore_http_ohandler) {
        
        if (!ohandler && !ignore_http_ohandler) {
+#ifdef PHP_OUTPUT_NEWAPI
+               ohandler = php_output_handler_started(ZEND_STRL("ob_defaltehandler") TSRMLS_CC) || php_output_handler_started(ZEND_STRL("http deflate") TSRMLS_CC);
+#else
                ohandler = php_ob_handler_used("ob_deflatehandler" TSRMLS_CC) || php_ob_handler_used("http deflate" TSRMLS_CC);
                ohandler = php_ob_handler_used("ob_deflatehandler" TSRMLS_CC) || php_ob_handler_used("http deflate" TSRMLS_CC);
+#endif
        }
        
        if (response && !ohandler) {
        }
        
        if (response && !ohandler) {
index 1695bce04da804440e2d853b77f2952dae9b9187..3340e4c446cf517d9e1166a906821b05c9c5c5ec 100644 (file)
@@ -97,8 +97,8 @@ zend_object_value _http_inflatestream_object_new_ex(zend_class_entry *ce, http_e
        }
 
 #ifdef ZEND_ENGINE_2_4
        }
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
index 66bc50823498f7d45f92a5474897f9145faefb6d..007437cfb30165eb4280c8a20df6534a3ae5df78 100644 (file)
@@ -119,7 +119,11 @@ PHP_HTTP_API http_message *_http_message_init_env(http_message *message, http_me
                        
                        http_message_set_info(message, &inf);
                        http_get_response_headers(&message->hdrs);
                        
                        http_message_set_info(message, &inf);
                        http_get_response_headers(&message->hdrs);
+#ifdef PHP_OUTPUT_NEWAPI
+                       if (SUCCESS == php_output_get_contents(&tval TSRMLS_CC)) {
+#else
                        if (SUCCESS == php_ob_get_buffer(&tval TSRMLS_CC)) {
                        if (SUCCESS == php_ob_get_buffer(&tval TSRMLS_CC)) {
+#endif
                                message->body.data = Z_STRVAL(tval);
                                message->body.used = Z_STRLEN(tval);
                                message->body.free = 1; /* "\0" */
                                message->body.data = Z_STRVAL(tval);
                                message->body.used = Z_STRLEN(tval);
                                message->body.free = 1; /* "\0" */
index 23974c3c48c2146a687541f308051ee81c61e61e..b7d8261752b675d8166bbe8ba78bbc49d82f367d 100644 (file)
@@ -515,8 +515,8 @@ zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message
 
        
 #ifdef ZEND_ENGINE_2_4
 
        
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
@@ -623,9 +623,12 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
        zval *headers;
        getObjectEx(http_message_object, obj, object);
        http_message *msg = obj->message;
        zval *headers;
        getObjectEx(http_message_object, obj, object);
        http_message *msg = obj->message;
-       HashTable *props = OBJ_PROP(obj);
        zval array, *parent;
        zval array, *parent;
-       
+#ifdef ZEND_ENGINE_2_4
+       HashTable *props = zend_get_std_object_handlers()->get_properties(object TSRMLS_CC);
+#else
+       HashTable *props = OBJ_PROP(obj);
+#endif
        INIT_ZARR(array, props);
 
 #define ASSOC_PROP(array, ptype, name, val) \
        INIT_ZARR(array, props);
 
 #define ASSOC_PROP(array, ptype, name, val) \
@@ -687,7 +690,7 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
        }
        ASSOC_PROP(array, zval, "parentMessage", parent);
 
        }
        ASSOC_PROP(array, zval, "parentMessage", parent);
 
-       return OBJ_PROP(obj);
+       return props;
 }
 
 /* ### USERLAND ### */
 }
 
 /* ### USERLAND ### */
index fd87294cc4aebfb6f22e1f9625efbbb63b62a895..4c82edabcff853fb0dfa9fe14886c9e0991b662f 100644 (file)
@@ -192,8 +192,8 @@ zend_object_value _http_querystring_object_new_ex(zend_class_entry *ce, void *no
        }
 
 #ifdef ZEND_ENGINE_2_4
        }
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
index 809512ade05d1ed6510a4f66679513b38c94fc37..b817841e84174297544f6d89621b758f812b0352 100644 (file)
@@ -148,6 +148,21 @@ PHP_HTTP_API void _http_request_info(http_request *request, HashTable *info)
                add_assoc_long_ex(&array, "condition_unmet", sizeof("condition_unmet"), l);
        }
 #endif
                add_assoc_long_ex(&array, "condition_unmet", sizeof("condition_unmet"), l);
        }
 #endif
+#if HTTP_CURL_VERSION(7,21,0)
+       if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_PRIMARY_PORT, &l)) {
+               add_assoc_long_ex(&array, "primary_port", sizeof("primary_port"), l);
+       }
+#endif
+#if HTTP_CURL_VERSION(7,21,0)
+       if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_LOCAL_IP, &c)) {
+               add_assoc_string_ex(&array, "local_ip", sizeof("local_ip"), c ? c : "", 1);
+       }
+#endif
+#if HTTP_CURL_VERSION(7,21,0)
+       if (CURLE_OK == curl_easy_getinfo(request->ch, CURLINFO_LOCAL_PORT, &l)) {
+               add_assoc_long_ex(&array, "local_port", sizeof("local_port"), l);
+       }
+#endif
 /* END */
 #if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL)
        {
 /* END */
 #if HTTP_CURL_VERSION(7,19,1) && defined(HTTP_HAVE_OPENSSL)
        {
index d502006f60a044d93a8e7142cf59bd5b6a12529c..f4f27cf0718892e48c918e6b5685c3ee28d1165e 100644 (file)
@@ -493,8 +493,8 @@ zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, ht
        }
 
 #ifdef ZEND_ENGINE_2_4
        }
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
@@ -683,7 +683,7 @@ STATUS _http_request_object_requesthandler(http_request_object *obj, zval *this_
                        
                        if (    (Z_TYPE_P(options) != IS_ARRAY)
                                ||      (SUCCESS != zend_hash_find(Z_ARRVAL_P(options), "onprogress", sizeof("onprogress"), (void *) &entry)
                        
                        if (    (Z_TYPE_P(options) != IS_ARRAY)
                                ||      (SUCCESS != zend_hash_find(Z_ARRVAL_P(options), "onprogress", sizeof("onprogress"), (void *) &entry)
-                               ||      (!IS_CALLABLE(*entry, 0, NULL)))) {
+                               ||      (!HTTP_IS_CALLABLE(*entry, 0, NULL)))) {
                                MAKE_STD_ZVAL(pcb);
                                array_init(pcb);
                                ZVAL_ADDREF(getThis());
                                MAKE_STD_ZVAL(pcb);
                                array_init(pcb);
                                ZVAL_ADDREF(getThis());
@@ -788,8 +788,12 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this
        
        return ret;
 }
        
        return ret;
 }
-
-static int apply_pretty_key(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
+#ifdef ZEND_ENGINE_2_4
+#      define APK_DC TSRMLS_DC
+#else
+#      define APK_DC
+#endif
+static int apply_pretty_key(void *pDest APK_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
        if (hash_key->arKey && hash_key->nKeyLength > 1) {
                hash_key->h = zend_hash_func(pretty_key(hash_key->arKey, hash_key->nKeyLength - 1, 1, 0), hash_key->nKeyLength);
 {
        if (hash_key->arKey && hash_key->nKeyLength > 1) {
                hash_key->h = zend_hash_func(pretty_key(hash_key->arKey, hash_key->nKeyLength - 1, 1, 0), hash_key->nKeyLength);
index b1491c1313e945d2585d5395fd8a5fff27a9594a..eed7d6b8ef125ecfb08c36e2a2f70c0a52b02d10 100644 (file)
@@ -126,8 +126,8 @@ zend_object_value _http_requestdatashare_object_new_ex(zend_class_entry *ce, htt
        }
 
 #ifdef ZEND_ENGINE_2_4
        }
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
index 47aa134729a9b3a2a76e16afa2f383b756e8a1d3..a0f219cb8429094abeb9f6b97da1f92c1f63ecda 100644 (file)
@@ -130,8 +130,8 @@ zend_object_value _http_requestpool_object_new(zend_class_entry *ce TSRMLS_DC)
        http_request_pool_init(&o->pool);
 
 #ifdef ZEND_ENGINE_2_4
        http_request_pool_init(&o->pool);
 
 #ifdef ZEND_ENGINE_2_4
-       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
-       object_properties_init(OBJ_PROP(o), ce);
+       zend_object_std_init(o, ce TSRMLS_CC);
+       object_properties_init(o, ce);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
 #else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
index cfa509566fcd7141c166b2500f517f50d2c104e2..c8d45cca997de2f9327f51a0f78ec5681b4678cb 100644 (file)
@@ -745,7 +745,11 @@ PHP_METHOD(HttpResponse, send)
                zval *zetag, *the_data;
 
                MAKE_STD_ZVAL(the_data);
                zval *zetag, *the_data;
 
                MAKE_STD_ZVAL(the_data);
+#ifdef PHP_OUTPUT_NEWAPI
+               php_output_get_contents(the_data TSRMLS_CC);
+#else
                php_ob_get_buffer(the_data TSRMLS_CC);
                php_ob_get_buffer(the_data TSRMLS_CC);
+#endif
                zend_update_static_property(THIS_CE, ZEND_STRS("data")-1, the_data TSRMLS_CC);
                ZVAL_LONG(*zend_std_get_static_property(THIS_CE, ZEND_STRS("mode")-1, 0 ZEND_LITERAL_NIL_CC TSRMLS_CC), SEND_DATA);
 
                zend_update_static_property(THIS_CE, ZEND_STRS("data")-1, the_data TSRMLS_CC);
                ZVAL_LONG(*zend_std_get_static_property(THIS_CE, ZEND_STRS("mode")-1, 0 ZEND_LITERAL_NIL_CC TSRMLS_CC), SEND_DATA);
 
@@ -767,7 +771,11 @@ PHP_METHOD(HttpResponse, send)
                /* interrupt on-the-fly etag generation */
                HTTP_G->etag.started = 0;
                /* discard previous output buffers */
                /* interrupt on-the-fly etag generation */
                HTTP_G->etag.started = 0;
                /* discard previous output buffers */
+#ifdef PHP_OUTPUT_NEWAPI
+               php_output_discard_all(TSRMLS_C);
+#else
                php_end_ob_buffers(0 TSRMLS_CC);
                php_end_ob_buffers(0 TSRMLS_CC);
+#endif
        }
 
        /* caching */
        }
 
        /* caching */
@@ -879,9 +887,13 @@ PHP_METHOD(HttpResponse, capture)
        HTTP_CHECK_HEADERS_SENT(RETURN_FALSE);
 
        zend_update_static_property_long(THIS_CE, ZEND_STRS("catch")-1, 1 TSRMLS_CC);
        HTTP_CHECK_HEADERS_SENT(RETURN_FALSE);
 
        zend_update_static_property_long(THIS_CE, ZEND_STRS("catch")-1, 1 TSRMLS_CC);
-
+#ifdef PHP_OUTPUT_NEWAPI
+       php_output_discard_all(TSRMLS_C);
+       php_output_start_default(TSRMLS_C);
+#else
        php_end_ob_buffers(0 TSRMLS_CC);
        php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
        php_end_ob_buffers(0 TSRMLS_CC);
        php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
+#endif
 
        /* register shutdown function */
        {
 
        /* register shutdown function */
        {
index 252aed9ae00f85910489276d4919731b07809130..6afa3acbfef9eb1e1dbf8575f098e0a5d6f7b85f 100644 (file)
--- a/missing.h
+++ b/missing.h
@@ -70,7 +70,7 @@
 #      define HTTP_ZAPI_CONST_CAST(t) (const t)
 #      define GLOBAL_ERROR_HANDLING EG(error_handling)
 #      define GLOBAL_EXCEPTION_CLASS EG(exception_class)
 #      define HTTP_ZAPI_CONST_CAST(t) (const t)
 #      define GLOBAL_ERROR_HANDLING EG(error_handling)
 #      define GLOBAL_EXCEPTION_CLASS EG(exception_class)
-#      define IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp) TSRMLS_CC)
+#      define HTTP_IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp) TSRMLS_CC)
 #      define HTTP_STATIC_ARG_INFO
 #else
 #      define HTTP_ZAPI_HASH_TSRMLS_CC
 #      define HTTP_STATIC_ARG_INFO
 #else
 #      define HTTP_ZAPI_HASH_TSRMLS_CC
@@ -78,7 +78,7 @@
 #      define HTTP_ZAPI_CONST_CAST(t) (t)
 #      define GLOBAL_ERROR_HANDLING PG(error_handling)
 #      define GLOBAL_EXCEPTION_CLASS PG(exception_class)
 #      define HTTP_ZAPI_CONST_CAST(t) (t)
 #      define GLOBAL_ERROR_HANDLING PG(error_handling)
 #      define GLOBAL_EXCEPTION_CLASS PG(exception_class)
-#      define IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp))
+#      define HTTP_IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp))
 #      define HTTP_STATIC_ARG_INFO static
 #endif
 
 #      define HTTP_STATIC_ARG_INFO static
 #endif
 
index 9b9575d0705e8a99e3ee3202138e2dbac4af02c7..72777400cb44ebc49eb296f6def6e3b898bf7664 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_HTTP_VERSION "1.7.1"
+#define PHP_HTTP_VERSION "1.7.2dev"
 
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
 
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
index fdee36d80bfcec98c42fa38e7b4da2c7e76fb147..45efd6e7616cd5f1189d10978ac1d8e664b85955 100644 (file)
@@ -96,12 +96,18 @@ extern STATUS _http_object_new(zend_object_value *ov, const char *cname_str, uin
                http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid compression level (-1 to 9): %d", level); \
                action; \
        }
                http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid compression level (-1 to 9): %d", level); \
                action; \
        }
-
+#ifndef PHP_OUTPUT_NEWAPI
+#      define HTTP_GET_OUTPUT_START() \
+               char *output_start_filename = php_get_output_start_filename(TSRMLS_C); \
+               int output_start_lineno = php_get_output_start_lineno(TSRMLS_C)
+#else
+#      define HTTP_GET_OUTPUT_START() \
+               char *output_start_filename = php_output_get_start_filename(TSRMLS_C); \
+               int output_start_lineno = php_output_get_start_lineno(TSRMLS_C)
+#endif
 #define HTTP_CHECK_HEADERS_SENT(action) \
        if (SG(headers_sent) && !SG(request_info).no_headers) { \
 #define HTTP_CHECK_HEADERS_SENT(action) \
        if (SG(headers_sent) && !SG(request_info).no_headers) { \
-               char *output_start_filename = php_get_output_start_filename(TSRMLS_C); \
-               int output_start_lineno = php_get_output_start_lineno(TSRMLS_C); \
-                \
+               HTTP_GET_OUTPUT_START(); \
                if (output_start_filename) { \
                        http_error_ex(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent by (output started at %s:%d)", \
                                output_start_filename, output_start_lineno); \
                if (output_start_filename) { \
                        http_error_ex(HE_WARNING, HTTP_E_HEADER, "Cannot modify header information - headers already sent by (output started at %s:%d)", \
                                output_start_filename, output_start_lineno); \
@@ -251,7 +257,7 @@ static inline zval *_http_zset(int type, zval *z)
 #define http_zsep(t, z) _http_zsep_ex((t), (z), NULL)
 #define http_zsep_ex(t, z, p) _http_zsep_ex((t), (z), (p))
 static inline zval *_http_zsep_ex(int type, zval *z, zval **p) {
 #define http_zsep(t, z) _http_zsep_ex((t), (z), NULL)
 #define http_zsep_ex(t, z, p) _http_zsep_ex((t), (z), (p))
 static inline zval *_http_zsep_ex(int type, zval *z, zval **p) {
-       SEPARATE_ARG_IF_REF(z);
+       Z_ADDREF_P(z);
        if (Z_TYPE_P(z) != type) {
                switch (type) {
                        case IS_NULL:   convert_to_null_ex(&z);         break;
        if (Z_TYPE_P(z) != type) {
                switch (type) {
                        case IS_NULL:   convert_to_null_ex(&z);         break;
@@ -262,6 +268,8 @@ static inline zval *_http_zsep_ex(int type, zval *z, zval **p) {
                        case IS_ARRAY:  convert_to_array_ex(&z);        break;
                        case IS_OBJECT: convert_to_object_ex(&z);       break;
                }
                        case IS_ARRAY:  convert_to_array_ex(&z);        break;
                        case IS_OBJECT: convert_to_object_ex(&z);       break;
                }
+       } else {
+               SEPARATE_ZVAL_IF_NOT_REF(&z);
        }
        if (p) {
                *p = z;
        }
        if (p) {
                *p = z;
index 1b08ffdd4c7dbf2e90297cb4d5c5da5dd0566b72..32c12333ae0062cdfad3867867735f051c647daf 100644 (file)
@@ -182,7 +182,11 @@ typedef int STATUS;
 #      define getObject(t, o) getObjectEx(t, o, getThis())
 #      define getObjectEx(t, o, v) t * o = ((t *) zend_object_store_get_object(v TSRMLS_CC))
 #      define putObject(t, o) zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) _ ##t## _free, NULL TSRMLS_CC);
 #      define getObject(t, o) getObjectEx(t, o, getThis())
 #      define getObjectEx(t, o, v) t * o = ((t *) zend_object_store_get_object(v TSRMLS_CC))
 #      define putObject(t, o) zend_objects_store_put(o, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) _ ##t## _free, NULL TSRMLS_CC);
-#      ifndef WONKY
+#      if defined(ZEND_ENGINE_2_4)
+#              define freeObject(o) \
+                       zend_object_std_dtor(o TSRMLS_CC); \
+                       efree(o);
+#      elif !defined(WONKY)
 #              define freeObject(o) \
                        if (OBJ_GUARDS(o)) { \
                                zend_hash_destroy(OBJ_GUARDS(o)); \
 #              define freeObject(o) \
                        if (OBJ_GUARDS(o)) { \
                                zend_hash_destroy(OBJ_GUARDS(o)); \
index f234685ea7abc8c36b4a936427e9325315b3a031..b69c96c5e2a781513fd4073e5aefb5de355ac5e7 100644 (file)
@@ -36,11 +36,16 @@ $ifdefs = array(
        'PRIMARY_IP' => 'HTTP_CURL_VERSION(7,19,0)',
        'APPCONNECT_TIME' => 'HTTP_CURL_VERSION(7,19,0)',
        'REDIRECT_URL' => 'HTTP_CURL_VERSION(7,18,2)',
        'PRIMARY_IP' => 'HTTP_CURL_VERSION(7,19,0)',
        'APPCONNECT_TIME' => 'HTTP_CURL_VERSION(7,19,0)',
        'REDIRECT_URL' => 'HTTP_CURL_VERSION(7,18,2)',
-       'CONDITION_UNMET' => 'HTTP_CURL_VERSION(7,19,4)',
+    'CONDITION_UNMET' => 'HTTP_CURL_VERSION(7,19,4)',
+    'PRIMARY_PORT' => 'HTTP_CURL_VERSION(7,21,0)',
+    'LOCAL_PORT' => 'HTTP_CURL_VERSION(7,21,0)',
+    'LOCAL_IP' => 'HTTP_CURL_VERSION(7,21,0)',
 );
 $exclude = array(
 );
 $exclude = array(
-       'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO',
+    'PRIVATE', 'LASTSOCKET', 'FTP_ENTRY_PATH', 'CERTINFO',
+    'RTSP_SESSION_ID', 'RTSP_CLIENT_CSEQ', 'RTSP_SERVER_CSEQ', 'RTSP_CSEQ_RECV'
 );
 );
+
 $translate = array(
        'HTTP_CONNECTCODE' => "connect_code",
        'COOKIELIST' => 'cookies',
 $translate = array(
        'HTTP_CONNECTCODE' => "connect_code",
        'COOKIELIST' => 'cookies',
index 81f9bc4e66a2f24cbc24f92b71eddb8fa5830eff..cf734aeee17ace5e15dc6cc0a6dbe8800edbbf36 100644 (file)
@@ -25,7 +25,7 @@ object(stdClass)%a {
   ["responseStatus"]=>
   string(2) "OK"
   ["headers"]=>
   ["responseStatus"]=>
   string(2) "OK"
   ["headers"]=>
-  array(8) {
+  array(%d) {
     %a
     ["Vary"]=>
     string(15) "Accept-Encoding"
     %a
     ["Vary"]=>
     string(15) "Accept-Encoding"