- Fix crash with non string property
[m6w6/ext-http] / php_http_std_defs.h
index d20579d8b025ca9618e3d73ea9aee3536018d3f4..0c5a9e5b3aa875f8587fc8c9977850cef5f1c638 100644 (file)
@@ -6,7 +6,7 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2007, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
@@ -58,6 +58,13 @@ 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))
@@ -182,25 +189,9 @@ 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);
-#      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)); \
-                       } \
+#      define freeObject(o) \
+                       zend_object_std_dtor(&o->zo TSRMLS_CC); \
                        efree(o);
-#      endif
 #      define OBJ_PROP(o) (o)->zo.properties
 #      define OBJ_GUARDS(o) (o)->zo.guards
 
@@ -219,8 +210,8 @@ typedef int STATUS;
 #ifdef ZEND_ENGINE_2
 #      define with_error_handling(eh, ec) \
        { \
-               error_handling_t __eh = PG(error_handling); \
-               zend_class_entry *__ec= PG(exception_class); \
+               error_handling_t __eh = GLOBAL_ERROR_HANDLING; \
+               zend_class_entry *__ec= GLOBAL_EXCEPTION_CLASS; \
                php_set_error_handling(eh, ec TSRMLS_CC);
 #      define end_error_handling() \
                php_set_error_handling(__eh, __ec TSRMLS_CC); \
@@ -266,8 +257,8 @@ typedef int STATUS;
 #define HTTP_E_QUERYSTRING                     13L
 
 #ifdef ZEND_ENGINE_2
-#      define HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args)     static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
-#      define HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args)     static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
+#      define HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args)     HTTP_STATIC_ARG_INFO ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
+#      define HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args)     HTTP_STATIC_ARG_INFO ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
 #      define HTTP_END_ARGS                                                                            }
 #      define HTTP_EMPTY_ARGS_EX(class, method, ret_ref)                       HTTP_BEGIN_ARGS_EX(class, method, ret_ref, 0) HTTP_END_ARGS
 #      define HTTP_ARGS(class, method)                                                         args_for_ ##class## _ ##method
@@ -284,20 +275,20 @@ typedef int STATUS;
 #ifdef HTTP_HAVE_CURL
 #      ifdef ZEND_ENGINE_2
 #              define HTTP_DECLARE_ARG_PASS_INFO() \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(1) \
                        ZEND_END_ARG_INFO(); \
  \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_3, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(1) \
                        ZEND_END_ARG_INFO(); \
  \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(0) \
@@ -305,7 +296,7 @@ typedef int STATUS;
                                ZEND_ARG_PASS_INFO(1) \
                        ZEND_END_ARG_INFO(); \
  \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_5, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(0) \
@@ -324,13 +315,13 @@ typedef int STATUS;
 #else
 #      ifdef ZEND_ENGINE_2
 #              define HTTP_DECLARE_ARG_PASS_INFO() \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(1) \
                        ZEND_END_ARG_INFO(); \
 \
-                       static \
+                       HTTP_STATIC_ARG_INFO \
                        ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \
                                ZEND_ARG_PASS_INFO(0) \
                                ZEND_ARG_PASS_INFO(0) \