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