- Fixed build with 5.4+
authorFelipe Pena <felipe@php.net>
Fri, 10 Jun 2011 22:03:12 +0000 (22:03 +0000)
committerFelipe Pena <felipe@php.net>
Fri, 10 Jun 2011 22:03:12 +0000 (22:03 +0000)
http_api.c
http_deflatestream_object.c
http_inflatestream_object.c
http_message_object.c
http_querystring_object.c
http_request_object.c
http_requestdatashare_object.c
http_requestpool_object.c
http_send_api.c
missing.h

index dbd8ab8452fc888ae1b1b9e3874f323884136f5f..2c31d10bde65f1b6a7bdea2eea5dc79c568d0386 100644 (file)
@@ -252,10 +252,17 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                STR_FREE(body);
                return FAILURE;
        }
                STR_FREE(body);
                return FAILURE;
        }
-       
-       if (!php_ob_handler_used("zlib output compression" TSRMLS_CC) && !php_ob_handler_used("ob_gzhandler" TSRMLS_CC) && !OG(ob_lock)) {
+
+       if (
+#if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
+               OG(active) && (OG(active)->flags & PHP_OUTPUT_HANDLER_FLUSHABLE) && 
+#else
+               !OG(ob_lock) &&
+#endif
+               !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_end_ob_buffers(0 TSRMLS_CC);
        }
+
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
        }
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
        }
index c3c80458685d9ce880d961b789cf8d450163be18..22f5c049cf7921a32b2322f7dd8753cc65a9017f 100644 (file)
@@ -107,9 +107,14 @@ zend_object_value _http_deflatestream_object_new_ex(zend_class_entry *ce, http_e
                o->stream = s;
        }
 
                o->stream = s;
        }
 
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_deflatestream_object, o);
        ov.handlers = &http_deflatestream_object_handlers;
 
        ov.handle = putObject(http_deflatestream_object, o);
        ov.handlers = &http_deflatestream_object_handlers;
index 53e5571e110768b56c57e5caa89d17c56b95fdeb..1695bce04da804440e2d853b77f2952dae9b9187 100644 (file)
@@ -96,9 +96,14 @@ zend_object_value _http_inflatestream_object_new_ex(zend_class_entry *ce, http_e
                o->stream = s;
        }
 
                o->stream = s;
        }
 
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_inflatestream_object, o);
        ov.handlers = &http_inflatestream_object_handlers;
 
        ov.handle = putObject(http_inflatestream_object, o);
        ov.handlers = &http_inflatestream_object_handlers;
index e7a564f2ba58349720d4a8a2336fb40e3e39091d..23974c3c48c2146a687541f308051ee81c61e61e 100644 (file)
@@ -513,9 +513,15 @@ zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message
                }
        }
 
                }
        }
 
+       
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_message_object, o);
        ov.handlers = &http_message_object_handlers;
 
        ov.handle = putObject(http_message_object, o);
        ov.handlers = &http_message_object_handlers;
index 0e7b2ac7127bcc0275efddc0677ebaa0a768aca3..fd87294cc4aebfb6f22e1f9625efbbb63b62a895 100644 (file)
@@ -191,9 +191,14 @@ zend_object_value _http_querystring_object_new_ex(zend_class_entry *ce, void *no
                *ptr = o;
        }
 
                *ptr = o;
        }
 
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_querystring_object, o);
        ov.handlers = &http_querystring_object_handlers;
 
        ov.handle = putObject(http_querystring_object, o);
        ov.handlers = &http_querystring_object_handlers;
index 8ea09b0f0af7a2528a1dbf01957b206dfd8f5175..d502006f60a044d93a8e7142cf59bd5b6a12529c 100644 (file)
@@ -492,9 +492,14 @@ zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, ht
                *ptr = o;
        }
 
                *ptr = o;
        }
 
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_request_object, o);
        ov.handlers = &http_request_object_handlers;
 
        ov.handle = putObject(http_request_object, o);
        ov.handlers = &http_request_object_handlers;
index 8eacef859dda72404903fc3f0af48f60e92f0f1f..b1491c1313e945d2585d5395fd8a5fff27a9594a 100644 (file)
@@ -125,9 +125,14 @@ zend_object_value _http_requestdatashare_object_new_ex(zend_class_entry *ce, htt
                *ptr = o;
        }
 
                *ptr = o;
        }
 
+#ifdef ZEND_ENGINE_2_4
+       zend_object_std_init(OBJ_PROP(o), ce TSRMLS_CC);
+       object_properties_init(OBJ_PROP(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);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_requestdatashare_object, o);
        ov.handlers = &http_requestdatashare_object_handlers;
 
        ov.handle = putObject(http_requestdatashare_object, o);
        ov.handlers = &http_requestdatashare_object_handlers;
@@ -147,7 +152,13 @@ void _http_requestdatashare_object_free(zend_object *object TSRMLS_DC)
 
 static zval *_http_requestdatashare_object_read_prop(zval *object, zval *member, int type ZEND_LITERAL_KEY_DC TSRMLS_DC)
 {
 
 static zval *_http_requestdatashare_object_read_prop(zval *object, zval *member, int type ZEND_LITERAL_KEY_DC TSRMLS_DC)
 {
-       if (type == BP_VAR_W && zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) {
+       if (type == BP_VAR_W && 
+#ifdef ZEND_ENGINE_2_4 
+       zend_hash_exists(&THIS_CE->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
+#else
+       zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
+#endif
+       ) {
                zend_error(E_ERROR, "Cannot access HttpRequestDataShare default properties by reference or array key/index");
                return NULL;
        }
                zend_error(E_ERROR, "Cannot access HttpRequestDataShare default properties by reference or array key/index");
                return NULL;
        }
@@ -157,7 +168,13 @@ static zval *_http_requestdatashare_object_read_prop(zval *object, zval *member,
 
 static void _http_requestdatashare_object_write_prop(zval *object, zval *member, zval *value ZEND_LITERAL_KEY_DC TSRMLS_DC)
 {
 
 static void _http_requestdatashare_object_write_prop(zval *object, zval *member, zval *value ZEND_LITERAL_KEY_DC TSRMLS_DC)
 {
-       if (zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) {
+       if (
+#ifdef ZEND_ENGINE_2_4
+       zend_hash_exists(&THIS_CE->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
+#else
+       zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
+#endif
+       ) {
                int status;
                getObjectEx(http_requestdatashare_object, obj, object);
                
                int status;
                getObjectEx(http_requestdatashare_object, obj, object);
                
index 653843a12381646071aa195dd39dc47022484ec2..47aa134729a9b3a2a76e16afa2f383b756e8a1d3 100644 (file)
@@ -129,9 +129,14 @@ zend_object_value _http_requestpool_object_new(zend_class_entry *ce TSRMLS_DC)
 
        http_request_pool_init(&o->pool);
 
 
        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);
+#else
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
        ALLOC_HASHTABLE(OBJ_PROP(o));
        zend_hash_init(OBJ_PROP(o), zend_hash_num_elements(&ce->default_properties), NULL, ZVAL_PTR_DTOR, 0);
        zend_hash_copy(OBJ_PROP(o), &ce->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
+#endif
 
        ov.handle = putObject(http_requestpool_object, o);
        ov.handlers = &http_requestpool_object_handlers;
 
        ov.handle = putObject(http_requestpool_object, o);
        ov.handlers = &http_requestpool_object_handlers;
index 319c7d6285a8c9da350e12a509c0bf8844a3f06f..1082e296460651f289dae088a558421e7505bf8b 100644 (file)
@@ -34,12 +34,16 @@ static inline void _http_flush(void *nothing, const char *data, size_t data_len
        /*      we really only need to flush when throttling is enabled,
                because we push the data as fast as possible anyway if not */
        if (HTTP_G->send.throttle_delay >= HTTP_DIFFSEC) {
        /*      we really only need to flush when throttling is enabled,
                because we push the data as fast as possible anyway if not */
        if (HTTP_G->send.throttle_delay >= HTTP_DIFFSEC) {
+#if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
+               php_output_end_all(TSRMLS_C);
+#else
                if (OG(ob_nesting_level)) {
                        php_end_ob_buffer(1, 1 TSRMLS_CC);
                }
                if (!OG(implicit_flush)) {
                        sapi_flush(TSRMLS_C);
                }
                if (OG(ob_nesting_level)) {
                        php_end_ob_buffer(1, 1 TSRMLS_CC);
                }
                if (!OG(implicit_flush)) {
                        sapi_flush(TSRMLS_C);
                }
+#endif
                http_sleep(HTTP_G->send.throttle_delay);
        }
 }
                http_sleep(HTTP_G->send.throttle_delay);
        }
 }
index de4f0831163e92ef20d115991225dfec945c6d68..252aed9ae00f85910489276d4919731b07809130 100644 (file)
--- a/missing.h
+++ b/missing.h
 
 #include "php_version.h"
 
 
 #include "php_version.h"
 
+#if ZEND_MODULE_API_NO >= 20100409
+#define ZEND_ENGINE_2_4
+#endif
+
 #if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
 #      define ZEND_LITERAL_KEY_DC , const zend_literal *_zend_literal_key
 #      define ZEND_LITERAL_KEY_CC , _zend_literal_key
 #if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
 #      define ZEND_LITERAL_KEY_DC , const zend_literal *_zend_literal_key
 #      define ZEND_LITERAL_KEY_CC , _zend_literal_key