pastebin - collaborative debugging tool
kpaste.net RSS

Difference between
modified post 7336d by Anonymous on Thu 13th Feb 2014 09:54
original post 4ee by Anonymous on Mon 9th Apr 2012 13:50
Download diff
Show old version | new version | both versions

    
11
--- a/execute.c
22
+++ b/execute.c
33
@@ -35,6 +35,7 @@
44
 #include "zend_compile.h"
55
 #include "zend_llist.h"
66
 #include "SAPI.h"
77
+#include "main/php_version.h"
88
99
 #include "sha256.h"
1010
1111
@@ -1031,7 +1032,9 @@
1212
1313
 	if ((str_length == sizeof("</head>\n")-1) && (strcmp(str, "</head>\n")==0)) {
1414
 		SUHOSIN_G(old_php_body_write)(S_META_ROBOTS, sizeof(S_META_ROBOTS)-1 TSRMLS_CC);
1515
+#if PHP_VERSION_ID < 50400
1616
 		OG(php_body_write) = SUHOSIN_G(old_php_body_write);
1717
+#endif
1818
 		return SUHOSIN_G(old_php_body_write)(str, str_length TSRMLS_CC);
1919
 	} else if ((str_length == sizeof(P_META_ROBOTS)-1) && (strcmp(str, P_META_ROBOTS)==0)) {
2020
 		return str_length;
2121
@@ -1054,6 +1057,7 @@
2222
 	}
2323
2424
 	/* Andale!  Andale!  Yee-Hah! */
2525
+#if PHP_VERSION_ID < 50400
2626
 	php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC);
2727
 	if (!sapi_module.phpinfo_as_text) {
2828
 		SUHOSIN_G(old_php_body_write) = OG(php_body_write);
2929
@@ -1061,6 +1065,11 @@
3030
 	}
3131
 	php_print_info(flag TSRMLS_CC);
3232
 	php_end_ob_buffer(1, 0 TSRMLS_CC);
3333
+#else
3434
+	php_output_start_default(TSRMLS_CC);
3535
+	php_print_info(flag TSRMLS_CC);
3636
+	php_output_end();
3737
+#endif
3838
3939
 	RETVAL_TRUE;
4040
 	return (1);
4141
@@ -1133,7 +1142,6 @@
4242
 		    retval = 0;
4343
 		}
4444
 	}
4545
-
4646
 	RETVAL_BOOL(retval);
4747
 	return (1);
4848
 }
4949
@@ -1523,7 +1531,9 @@
5050
 	{ "srand", ih_srand, NULL, NULL, NULL },
5151
 	{ "mt_srand", ih_mt_srand, NULL, NULL, NULL },
5252
 	{ "rand", ih_rand, NULL, NULL, NULL },
5353
+#if PHP_VERSION_ID < 50400 // Disabled due to segfault
5454
 	{ "mt_rand", ih_mt_rand, NULL, NULL, NULL },
5555
+#endif
5656
 	{ "getrandmax", ih_getrandmax, NULL, NULL, NULL },
5757
 	{ "mt_getrandmax", ih_getrandmax, NULL, NULL, NULL },
5858
5959
@@ -1538,7 +1548,9 @@
6060
     { "fbsql_connect", ih_fixusername, (void *)2, NULL, NULL },
6161
     { "fbsql_pconnect", ih_fixusername, (void *)2, NULL, NULL },
6262
6363
+#if PHP_VERSION_ID < 50400 // Disabled due to segfault
6464
     { "function_exists", ih_function_exists, NULL, NULL, NULL },
6565
+#endif
6666
6767
     { "ifx_connect", ih_fixusername, (void *)2, NULL, NULL },
6868
     { "ifx_pconnect", ih_fixusername, (void *)2, NULL, NULL },
6969
@@ -1606,8 +1618,14 @@
7070
 	}
7171
7272
 #ifdef ZEND_ENGINE_2
7373
+
7474
+#if PHP_VERSION_ID < 50400
7575
 	return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr;
7676
 #else
7777
+	return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->extended_value)).var.ptr;
7878
+#endif
7979
+
8080
+#else
8181
         return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr;
8282
 #endif
8383
 	ht = execute_data_ptr->opline->extended_value;
8484
--- a/rfc1867.c
8585
+++ b/rfc1867.c
8686
@@ -35,6 +35,7 @@
8787
 #include "suhosin_rfc1867.h"
8888
 #include "php_ini.h"
8989
 #include "ext/standard/php_string.h"
9090
+#include "main/php_version.h"
9191
9292
 #define DEBUG_FILE_UPLOAD ZEND_DEBUG
9393
9494
@@ -244,21 +245,29 @@
9595
9696
 static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
9797
 {
9898
+#if PHP_VERSION_ID < 50400
9999
 	int register_globals = PG(register_globals);
100100
101101
 	PG(register_globals) = 0;
102102
+#endif
103103
 	safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC);
104104
+#if PHP_VERSION_ID < 50400
105105
 	PG(register_globals) = register_globals;
106106
+#endif
107107
 }
108108
109109
110110
 static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
111111
 {
112112
+#if PHP_VERSION_ID < 50400
113113
 	int register_globals = PG(register_globals);
114114
115115
 	PG(register_globals) = 0;
116116
+#endif
117117
 	safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC);
118118
+#if PHP_VERSION_ID < 50400
119119
 	PG(register_globals) = register_globals;
120120
+#endif
121121
 }
122122
123123
 /*
124124
--- a/session.c
125125
+++ b/session.c
126126
@@ -33,6 +33,7 @@
127127
 #include "ext/standard/php_smart_str.h"
128128
 #include "ext/standard/php_var.h"
129129
 #include "sha256.h"
130130
+#include "main/php_version.h"
131131
132132
 #include <fcntl.h>
133133
134134
@@ -294,6 +295,7 @@
135135
     if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) {
136136
         ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var);
137137
138138
+#if PHP_VERSION_ID < 50400
139139
         /* If register_globals is enabled, and
140140
          * if there is an entry for the slot in $_SESSION, and
141141
          * if that entry is still set to NULL, and
142142
@@ -307,6 +309,7 @@
143143
                 *state_var = tmp;
144144
             }
145145
         }
146146
+#endif
147147
     }
148148
     return ret;
149149
 }
150150
--- a/log.c
151151
+++ b/log.c
152152
@@ -31,6 +31,7 @@
153153
 #include "SAPI.h"
154154
 #include "ext/standard/datetime.h"
155155
 #include "ext/standard/flock_compat.h"
156156
+#include "main/php_version.h"
157157
158158
 #ifdef HAVE_SYS_SOCKET_H
159159
 #include <sys/socket.h>
160160
@@ -317,7 +318,9 @@
161161
 		zval *result = NULL;
162162
163163
 		long orig_execution_depth = SUHOSIN_G(execution_depth);
164164
+#if PHP_VERSION_ID < 50400
165165
 		zend_bool orig_safe_mode = PG(safe_mode);
166166
+#endif
167167
 		char *orig_basedir = PG(open_basedir);
168168
169169
 		char *phpscript = SUHOSIN_G(log_phpscriptname);
170170
@@ -354,14 +357,18 @@
171171
172172
 				SUHOSIN_G(execution_depth) = 0;
173173
 				if (SUHOSIN_G(log_phpscript_is_safe)) {
174174
+#if PHP_VERSION_ID < 50400
175175
 					PG(safe_mode) = 0;
176176
+#endif
177177
 					PG(open_basedir) = NULL;
178178
 				}
179179
180180
 				zend_execute(new_op_array TSRMLS_CC);
181181
182182
 				SUHOSIN_G(execution_depth) = orig_execution_depth;
183183
+#if PHP_VERSION_ID < 50400
184184
 				PG(safe_mode) = orig_safe_mode;
185185
+#endif
186186
 				PG(open_basedir) = orig_basedir;
187187
188188
 #ifdef ZEND_ENGINE_2
189189
--- a/sha256.c
190190
+++ b/sha256.c
191191
@@ -86,9 +86,11 @@
192192
 		return;
193193
 	}
194194
195195
+#if PHP_VERSION_ID < 50400
196196
 	if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
197197
 		RETURN_FALSE;
198198
 	}
199199
+#endif
200200
201201
 	if (php_check_open_basedir(arg TSRMLS_CC)) {
202202
 		RETURN_FALSE;
203203
@@ -392,7 +394,7 @@
204204
205205
 /* {{{ suhosin_sha256_functions[]
206206
  */
207207
-static function_entry suhosin_sha256_functions[] = {
208208
+static zend_function_entry suhosin_sha256_functions[] = {
209209
 	PHP_NAMED_FE(sha256, PHP_FN(suhosin_sha256), NULL)
210210
 	PHP_NAMED_FE(sha256_file, PHP_FN(suhosin_sha256_file), NULL)
211211
 	{NULL, NULL, NULL}
212212
--- a/suhosin.c
213213
+++ b/suhosin.c
214214
@@ -646,12 +646,16 @@
215215
 				array_init(gpc_element);
216216
 				zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
217217
 			} else {
218218
+#if PHP_VERSION_ID < 50400
219219
 				if (PG(magic_quotes_gpc) && (index != var)) {
220220
 					/* no need to addslashes() the index if it's the main variable name */
221221
 					escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
222222
 				} else {
223223
+#endif
224224
 					escaped_index = index;
225225
+#if PHP_VERSION_ID < 50400
226226
 				}
227227
+#endif
228228
 				if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
229229
 					|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
230230
 					MAKE_STD_ZVAL(gpc_element);
231231
@@ -683,11 +687,15 @@
232232
 		if (!index) {
233233
 			zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
234234
 		} else {
235235
+#if PHP_VERSION_ID < 50400
236236
 			if (PG(magic_quotes_gpc)) {
237237
 				escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
238238
 			} else {
239239
+#endif
240240
 				escaped_index = index;
241241
+#if PHP_VERSION_ID < 50400
242242
 			}
243243
+#endif
244244
 			/*
245245
 			 * According to rfc2965, more specific paths are listed above the less specific ones.
246246
 			 * If we encounter a duplicate cookie name, we should skip it, since it is not possible
247247
@@ -714,11 +722,15 @@
248248
249249
 	/* Prepare value */
250250
 	Z_STRLEN(new_entry) = str_len;
251251
+#if PHP_VERSION_ID < 50400
252252
 	if (PG(magic_quotes_gpc)) {
253253
 		Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC);
254254
 	} else {
255255
+#endif
256256
 		Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
257257
+#if PHP_VERSION_ID < 50400
258258
 	}
259259
+#endif
260260
 	Z_TYPE(new_entry) = IS_STRING;
261261
262262
 	suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC);
263263
--- a/ex_imp.c
264264
+++ b/ex_imp.c
265265
@@ -727,7 +727,7 @@
266266
267267
 /* {{{ suhosin_ex_imp_functions[]
268268
  */
269269
-function_entry suhosin_ex_imp_functions[] = {
270270
+zend_function_entry suhosin_ex_imp_functions[] = {
271271
 	PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), suhosin_arginfo_extract)
272272
 	PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), suhosin_arginfo_import_request_variables)
273273
 	{NULL, NULL, NULL}
274274

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at