fix error in http_get_request_body spottet by rob
[m6w6/ext-http] / missing.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2010, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #ifndef PHP_HTTP_MISSING
16 #define PHP_HTTP_MISSING
17
18 #include "php_version.h"
19
20 #if defined(PHP_VERSION_ID) && (PHP_VERSION_ID >= 50399)
21 # define ZEND_LITERAL_KEY_DC , const zend_literal *_zend_literal_key
22 # define ZEND_LITERAL_KEY_CC , _zend_literal_key
23 # define ZEND_LITERAL_NIL_CC , NULL
24 # define HTTP_CHECK_OPEN_BASEDIR(file, act) \
25 if ((PG(open_basedir) && *PG(open_basedir))) \
26 { \
27 const char *tmp = file; \
28 \
29 if (!strncasecmp(tmp, "file:", lenof("file:"))) { \
30 tmp += lenof("file:"); \
31 while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \
32 } \
33 \
34 if ( (tmp != file || !strstr(file, "://")) && \
35 (!*tmp || php_check_open_basedir(tmp TSRMLS_CC))) { \
36 act; \
37 } \
38 }
39
40 #else
41 # define ZEND_LITERAL_KEY_DC
42 # define ZEND_LITERAL_KEY_CC
43 # define ZEND_LITERAL_NIL_CC
44 # define HTTP_CHECK_OPEN_BASEDIR(file, act) \
45 if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) \
46 { \
47 const char *tmp = file; \
48 \
49 if (!strncasecmp(tmp, "file:", lenof("file:"))) { \
50 tmp += lenof("file:"); \
51 while ((tmp - (const char *)file < 7) && (*tmp == '/' || *tmp == '\\')) ++tmp; \
52 } \
53 \
54 if ( (tmp != file || !strstr(file, "://")) && \
55 (!*tmp || php_check_open_basedir(tmp TSRMLS_CC) || \
56 (PG(safe_mode) && !php_checkuid(tmp, "rb+", CHECKUID_CHECK_MODE_PARAM)))) { \
57 act; \
58 } \
59 }
60
61 #endif
62
63 #if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)
64 # define HTTP_ZAPI_HASH_TSRMLS_CC TSRMLS_CC
65 # define HTTP_ZAPI_HASH_TSRMLS_DC TSRMLS_DC
66 # define HTTP_ZAPI_CONST_CAST(t) (const t)
67 # define GLOBAL_ERROR_HANDLING EG(error_handling)
68 # define GLOBAL_EXCEPTION_CLASS EG(exception_class)
69 # define IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp) TSRMLS_CC)
70 # define HTTP_STATIC_ARG_INFO
71 #else
72 # define HTTP_ZAPI_HASH_TSRMLS_CC
73 # define HTTP_ZAPI_HASH_TSRMLS_DC
74 # define HTTP_ZAPI_CONST_CAST(t) (t)
75 # define GLOBAL_ERROR_HANDLING PG(error_handling)
76 # define GLOBAL_EXCEPTION_CLASS PG(exception_class)
77 # define IS_CALLABLE(cb_zv, flags, cb_sp) zend_is_callable((cb_zv), (flags), (cb_sp))
78 # define HTTP_STATIC_ARG_INFO static
79 #endif
80
81 #if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION == 0)
82 # define WONKY
83 #endif
84
85 #ifndef pemalloc_rel
86 # define pemalloc_rel(size, persistent) ((persistent)?malloc(size):emalloc_rel(size))
87 #endif
88
89 #ifndef ZEND_ACC_DEPRECATED
90 # define ZEND_ACC_DEPRECATED 0
91 #endif
92
93 #if PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10
94 # define php_url_parse_ex(u, l) php_url_parse(u)
95 #endif
96
97 #ifndef TSRMLS_FETCH_FROM_CTX
98 # ifdef ZTS
99 # define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
100 # else
101 # define TSRMLS_FETCH_FROM_CTX(ctx)
102 # endif
103 #endif
104
105 #ifndef TSRMLS_SET_CTX
106 # ifdef ZTS
107 # define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
108 # else
109 # define TSRMLS_SET_CTX(ctx)
110 # endif
111 #endif
112
113 #ifndef ZVAL_ADDREF
114 # define ZVAL_ADDREF Z_ADDREF_P
115 #endif
116
117 #ifndef SEPARATE_ARG_IF_REF
118 #define SEPARATE_ARG_IF_REF(zv) \
119 if (PZVAL_IS_REF(zv)) { \
120 zval *ov = zv; \
121 ALLOC_INIT_ZVAL(zv); \
122 Z_TYPE_P(zv) = Z_TYPE_P(ov); \
123 zv->value = ov->value; \
124 zval_copy_ctor(zv); \
125 } else { \
126 ZVAL_ADDREF(zv); \
127 }
128 #endif
129
130 #ifndef ZVAL_ZVAL
131 #define ZVAL_ZVAL(z, zv, copy, dtor) { \
132 int is_ref, refcount; \
133 is_ref = (z)->is_ref; \
134 refcount = (z)->refcount; \
135 *(z) = *(zv); \
136 if (copy) { \
137 zval_copy_ctor(z); \
138 } \
139 if (dtor) { \
140 if (!copy) { \
141 ZVAL_NULL(zv); \
142 } \
143 zval_ptr_dtor(&zv); \
144 } \
145 (z)->is_ref = is_ref; \
146 (z)->refcount = refcount; \
147 }
148 #endif
149 #ifndef RETVAL_ZVAL
150 # define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
151 #endif
152 #ifndef RETURN_ZVAL
153 # define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
154 #endif
155
156 #ifndef ZEND_MN
157 # define ZEND_MN(name) ZEND_FN(name)
158 #endif
159
160 #ifdef WONKY
161 extern int zend_declare_property_double(zend_class_entry *ce, char *name, int name_length, double value, int access_type TSRMLS_DC);
162 extern void zend_update_property_double(zend_class_entry *scope, zval *object, char *name, int name_length, double value TSRMLS_DC);
163
164 extern int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
165 extern void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
166
167 extern void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC);
168 #endif
169
170 #endif
171
172 /*
173 * Local variables:
174 * tab-width: 4
175 * c-basic-offset: 4
176 * End:
177 * vim600: noet sw=4 ts=4 fdm=marker
178 * vim<600: noet sw=4 ts=4
179 */
180