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