* revert incomplete trunk-compatibility-patch
authorMichael Wallner <mike@php.net>
Wed, 9 Jun 2010 06:23:16 +0000 (06:23 +0000)
committerMichael Wallner <mike@php.net>
Wed, 9 Jun 2010 06:23:16 +0000 (06:23 +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
php_http_std_defs.h

index aebd434209deb323f2c2ba3dac0b73649f276222..aca90e669f5adeed209212cb1fbbc86bb34827e1 100644 (file)
@@ -253,15 +253,9 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header
                return FAILURE;
        }
        
-#if PHP_VERSION_ID < 50399
        if (!OG(ob_lock)) {
                php_end_ob_buffers(0 TSRMLS_CC);
        }
-#else
-       if (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_LOCKED) {
-               php_output_end_all(TSRMLS_C);
-       }
-#endif
        if ((SUCCESS == sapi_send_headers(TSRMLS_C)) && body) {
                PHPWRITE(body, strlen(body));
        }
index f30cc6a0cffa4c7e62aa45fe48951aa73a5187de..c3c80458685d9ce880d961b789cf8d450163be18 100644 (file)
@@ -107,13 +107,9 @@ zend_object_value _http_deflatestream_object_new_ex(zend_class_entry *ce, http_e
                o->stream = s;
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_deflatestream_object, o);
        ov.handlers = &http_deflatestream_object_handlers;
index 18ca266990abbdb61c2049af31ce2da9e87d311c..53e5571e110768b56c57e5caa89d17c56b95fdeb 100644 (file)
@@ -96,13 +96,9 @@ zend_object_value _http_inflatestream_object_new_ex(zend_class_entry *ce, http_e
                o->stream = s;
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_inflatestream_object, o);
        ov.handlers = &http_inflatestream_object_handlers;
index 3129193147c2404e8bb66d804f2dd43c292d5e78..a5b2ca82616d38f78bf94e3dba62a6c65df6bc4d 100644 (file)
@@ -513,14 +513,9 @@ zend_object_value _http_message_object_new_ex(zend_class_entry *ce, http_message
                }
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       zend_object_std_init(&o->zo, ce TSRMLS_CC);
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_message_object, o);
        ov.handlers = &http_message_object_handlers;
@@ -579,24 +574,11 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
 {
        getObjectEx(http_message_object, obj, object);
        http_message_object_prophandler *handler;
-       zval *return_value, *tmp_member = NULL;
-       
-       if (Z_TYPE_P(member) != IS_STRING) {
-               ALLOC_ZVAL(tmp_member);
-               MAKE_COPY_ZVAL(&member, tmp_member);
-               convert_to_string(tmp_member);
-               member = tmp_member;
-#if PHP_VERSION_ID >= 50399
-               _zend_literal_key = NULL;
-#endif
-       }
+       zval *return_value;
 
        if (SUCCESS == http_message_object_get_prophandler(Z_STRVAL_P(member), Z_STRLEN_P(member), &handler)) {
                if (type == BP_VAR_W) {
                        zend_error(E_ERROR, "Cannot access HttpMessage properties by reference or array key/index");
-                       if (tmp_member) {
-                               zval_ptr_dtor(&tmp_member);
-                       }
                        return NULL;
                }
 
@@ -615,9 +597,6 @@ static zval *_http_message_object_read_prop(zval *object, zval *member, int type
                return_value = zend_get_std_object_handlers()->read_property(object, member, type ZEND_LITERAL_KEY_CC TSRMLS_CC);
        }
        
-       if (tmp_member) {
-               zval_ptr_dtor(&tmp_member);
-       }
        return return_value;
 }
 
@@ -625,26 +604,12 @@ static void _http_message_object_write_prop(zval *object, zval *member, zval *va
 {
        getObjectEx(http_message_object, obj, object);
        http_message_object_prophandler *handler;
-       zval *tmp_member = NULL;
-       
-       if (Z_TYPE_P(member) != IS_STRING) {
-               ALLOC_ZVAL(tmp_member);
-               MAKE_COPY_ZVAL(&member, tmp_member);
-               convert_to_string(tmp_member);
-               member = tmp_member;
-#if PHP_VERSION_ID >= 50399
-               _zend_literal_key = NULL;
-#endif
-       }
        
        if (SUCCESS == http_message_object_get_prophandler(Z_STRVAL_P(member), Z_STRLEN_P(member), &handler)) {
                handler->write(obj, value TSRMLS_CC);
        } else {
                zend_get_std_object_handlers()->write_property(object, member, value ZEND_LITERAL_KEY_CC TSRMLS_CC);
        }
-       if (tmp_member) {
-               zval_ptr_dtor(&tmp_member);
-       }
 }
 
 static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
@@ -652,11 +617,7 @@ static HashTable *_http_message_object_get_props(zval *object TSRMLS_DC)
        zval *headers;
        getObjectEx(http_message_object, obj, object);
        http_message *msg = obj->message;
-#if PHP_VERSION_ID < 50399
        HashTable *props = OBJ_PROP(obj);
-#else
-       HashTable *props = zend_std_get_properties(object TSRMLS_CC);
-#endif
        zval array, *parent;
        
        INIT_ZARR(array, props);
index 88d4c835c90440b2ee208b043c007db816f8410a..0e7b2ac7127bcc0275efddc0677ebaa0a768aca3 100644 (file)
@@ -191,13 +191,9 @@ zend_object_value _http_querystring_object_new_ex(zend_class_entry *ce, void *no
                *ptr = o;
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_querystring_object, o);
        ov.handlers = &http_querystring_object_handlers;
index f06157a4e2c4f96fd3209bf4e5f126dc02b39b5f..8ea09b0f0af7a2528a1dbf01957b206dfd8f5175 100644 (file)
@@ -492,13 +492,9 @@ zend_object_value _http_request_object_new_ex(zend_class_entry *ce, CURL *ch, ht
                *ptr = o;
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_request_object, o);
        ov.handlers = &http_request_object_handlers;
index 060493556807323dce2e14c4e02f5eb9ca1cc74e..8eacef859dda72404903fc3f0af48f60e92f0f1f 100644 (file)
@@ -125,13 +125,9 @@ zend_object_value _http_requestdatashare_object_new_ex(zend_class_entry *ce, htt
                *ptr = o;
        }
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_requestdatashare_object, o);
        ov.handlers = &http_requestdatashare_object_handlers;
@@ -151,13 +147,7 @@ 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)
 {
-       if (type == BP_VAR_W && 
-#if PHP_VERSION_ID < 50399
-       zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)
-#else
-       zend_get_property_info(THIS_CE, member, 1 TSRMLS_CC)
-#endif 
-       ) {
+       if (type == BP_VAR_W && zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) {
                zend_error(E_ERROR, "Cannot access HttpRequestDataShare default properties by reference or array key/index");
                return NULL;
        }
@@ -167,11 +157,7 @@ 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)
 {
-#if PHP_VERSION_ID < 50399
        if (zend_hash_exists(&THIS_CE->default_properties, Z_STRVAL_P(member), Z_STRLEN_P(member)+1)) {
-#else
-       if (zend_get_property_info(THIS_CE, member, 1 TSRMLS_CC)) {
-#endif
                int status;
                getObjectEx(http_requestdatashare_object, obj, object);
                
index 43941bb84faee94c40b705663d243d444ee8004d..653843a12381646071aa195dd39dc47022484ec2 100644 (file)
@@ -129,13 +129,9 @@ zend_object_value _http_requestpool_object_new(zend_class_entry *ce TSRMLS_DC)
 
        http_request_pool_init(&o->pool);
 
-#if PHP_VERSION_ID < 50399
        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 *));
-#else
-       object_properties_init(&o->zo, ce);
-#endif
 
        ov.handle = putObject(http_requestpool_object, o);
        ov.handlers = &http_requestpool_object_handlers;
index d8bc1a0e57f7a0d1277c72b21080f0f7e9940252..319c7d6285a8c9da350e12a509c0bf8844a3f06f 100644 (file)
@@ -34,24 +34,12 @@ 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) {
-#if PHP_VERSION_ID < 50399
                if (OG(ob_nesting_level)) {
                        php_end_ob_buffer(1, 1 TSRMLS_CC);
                }
                if (!OG(implicit_flush)) {
                        sapi_flush(TSRMLS_C);
                }
-#else
-               int ob_level;
-               
-               if ((php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL, &ob_level TSRMLS_CC) == SUCCESS) && ob_level > 0) {
-                       php_output_discard(TSRMLS_C);
-               }
-               
-               if (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_IMPLICITFLUSH) {
-                       sapi_flush(TSRMLS_C);
-               }
-#endif
                http_sleep(HTTP_G->send.throttle_delay);
        }
 }
index 0c5a9e5b3aa875f8587fc8c9977850cef5f1c638..456ae74ca4a8f2a04d0af87bc53d926adfca7050 100644 (file)
@@ -58,13 +58,6 @@ typedef int STATUS;
                Z_ARRVAL(zv) = (ht); \
        }
 
-#ifndef MAKE_COPY_ZVAL
-# define MAKE_COPY_ZVAL(ppzv, pzv) \
-       *(pzv) = **(ppzv);            \
-       zval_copy_ctor((pzv));        \
-       INIT_PZVAL((pzv));
-#endif
-    
 /* return bool (v == SUCCESS) */
 #define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
 #define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
@@ -189,9 +182,25 @@ 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 freeObject(o) \
-                       zend_object_std_dtor(&o->zo TSRMLS_CC); \
+#      ifndef WONKY
+#              define freeObject(o) \
+                       if (OBJ_GUARDS(o)) { \
+                               zend_hash_destroy(OBJ_GUARDS(o)); \
+                               FREE_HASHTABLE(OBJ_GUARDS(o)); \
+                       } \
+                       if (OBJ_PROP(o)) { \
+                               zend_hash_destroy(OBJ_PROP(o)); \
+                               FREE_HASHTABLE(OBJ_PROP(o)); \
+                       } \
+                       efree(o);
+#      else
+#              define freeObject(o) \
+                       if (OBJ_PROP(o)) { \
+                               zend_hash_destroy(OBJ_PROP(o)); \
+                               FREE_HASHTABLE(OBJ_PROP(o)); \
+                       } \
                        efree(o);
+#      endif
 #      define OBJ_PROP(o) (o)->zo.properties
 #      define OBJ_GUARDS(o) (o)->zo.guards