- E_THROW for PHP4 too
[m6w6/ext-http] / php_http_std_defs.h
index 4d9523d8a49a628ac0fa67428211fe80ff00f5a1..03911a83a02a3eba670a1e2f72c5e497fc08c8bd 100644 (file)
@@ -34,7 +34,10 @@ typedef int STATUS;
 #define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
 
 /* function accepts no args */
-#define NO_ARGS if (ZEND_NUM_ARGS()) WRONG_PARAM_COUNT
+#define NO_ARGS \
+       if (ZEND_NUM_ARGS()) { \
+               zend_error(E_NOTICE, "Wrong parameter count for %s()", get_active_function_name(TSRMLS_C)); \
+       }
 
 /* CR LF */
 #define HTTP_CRLF "\r\n"
@@ -83,25 +86,27 @@ typedef int STATUS;
 #define array_merge(src, dst)  zend_hash_merge(Z_ARRVAL_P(dst), Z_ARRVAL_P(src), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *), 1)
 /* }}} */
 
+#define HTTP_LONG_CONSTANT(name, const) REGISTER_LONG_CONSTANT(name, const, CONST_CS | CONST_PERSISTENT);
+
 /* {{{ objects & properties */
 #ifdef ZEND_ENGINE_2
 
+
 #      define HTTP_REGISTER_CLASS_EX(classname, name, parent, flags) \
        { \
                zend_class_entry ce; \
-               INIT_CLASS_ENTRY(ce, #classname, name## _class_methods); \
-               ce.create_object = name## _new_object; \
+               INIT_CLASS_ENTRY(ce, #classname, name## _fe); \
+               ce.create_object = name## _new; \
                name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
                name## _ce->ce_flags |= flags;  \
-               memcpy(& name## _object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
-               name## _object_handlers.clone_obj = NULL; \
-               name## _declare_default_properties(name## _ce); \
+               memcpy(& name## _handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); \
+               name## _declare_default_properties(); \
        }
 
 #      define HTTP_REGISTER_CLASS(classname, name, parent, flags) \
        { \
                zend_class_entry ce; \
-               INIT_CLASS_ENTRY(ce, #classname, name## _class_methods); \
+               INIT_CLASS_ENTRY(ce, #classname, name## _fe); \
                ce.create_object = NULL; \
                name## _ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
                name## _ce->ce_flags |= flags;  \
@@ -135,9 +140,26 @@ typedef int STATUS;
                } \
        }
 
+#      define SET_EH_THROW() SET_EH_THROW_EX(zend_exception_get_default())
+#      define SET_EH_THROW_HTTP() SET_EH_THROW_EX(http_exception_get_default())
+#      define SET_EH_THROW_EX(ex) php_set_error_handling(EH_THROW, ex TSRMLS_CC)
+#      define SET_EH_NORMAL() php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC)
+
 #endif /* ZEND_ENGINE_2 */
 /* }}} */
 
+#ifndef E_THROW
+#      define E_THROW 0
+#endif
+
+#define HTTP_E_UNKOWN          0L
+#define HTTP_E_PARSE           1L
+#define HTTP_E_HEADER          2L
+#define HTTP_E_OBUFFER         3L
+#define HTTP_E_CURL                    4L
+#define HTTP_E_ENCODE          5L
+#define HTTP_E_PARAM           6L
+#define HTTP_E_URL                     7L
 
 #endif /* PHP_HTTP_STD_DEFS_H */