pastebin - collaborative debugging tool
kpaste.net RSS

Difference between
modified post 27ebe7 by Anonymous on Mon 9th Apr 2012 13:49
original post 616fc4 by Anonymous on Fri 9th Mar 2012 18:09
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);
41-
@@ -1606,8 +1615,14 @@
41+
@@ -1133,7 +1142,6 @@
42+
 		    retval = 0;
4243
 	}
44+
 	}
4352
53+
+#if PHP_VERSION_ID < 50400 // Disabled due to segfault
5055
+#endif
56+
5163
+
64+
+#if PHP_VERSION_ID < 50400
5270
+#else
5371
         return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr;
5472
 #endif
5573
 	ht = execute_data_ptr->opline->extended_value;
5674
--- a/rfc1867.c
5775
+++ b/rfc1867.c
5876
@@ -35,6 +35,7 @@
5977
 #include "suhosin_rfc1867.h"
6078
 #include "php_ini.h"
6179
 #include "ext/standard/php_string.h"
6280
+#include "main/php_version.h"
6381
6482
 #define DEBUG_FILE_UPLOAD ZEND_DEBUG
6583
6684
@@ -244,21 +245,29 @@
6785
6886
 static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
6987
 {
7088
+#if PHP_VERSION_ID < 50400
7189
 	int register_globals = PG(register_globals);
7290
7391
 	PG(register_globals) = 0;
7492
+#endif
7593
 	safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC);
7694
+#if PHP_VERSION_ID < 50400
7795
 	PG(register_globals) = register_globals;
7896
+#endif
7997
 }
8098
8199
82100
 static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
83101
 {
84102
+#if PHP_VERSION_ID < 50400
85103
 	int register_globals = PG(register_globals);
86104
87105
 	PG(register_globals) = 0;
88106
+#endif
89107
 	safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC);
90108
+#if PHP_VERSION_ID < 50400
91109
 	PG(register_globals) = register_globals;
92110
+#endif
93111
 }
94112
95113
 /*
96114
--- a/session.c
97115
+++ b/session.c
98116
@@ -33,6 +33,7 @@
99117
 #include "ext/standard/php_smart_str.h"
100118
 #include "ext/standard/php_var.h"
101119
 #include "sha256.h"
102120
+#include "main/php_version.h"
103121
104122
 #include <fcntl.h>
105123
106124
@@ -294,6 +295,7 @@
107125
     if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) {
108126
         ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var);
109127
110128
+#if PHP_VERSION_ID < 50400
111129
         /* If register_globals is enabled, and
112130
          * if there is an entry for the slot in $_SESSION, and
113131
          * if that entry is still set to NULL, and
114132
@@ -307,6 +309,7 @@
115133
                 *state_var = tmp;
116134
             }
117135
         }
118136
+#endif
119137
     }
120138
     return ret;
121139
 }
122140
--- a/log.c
123141
+++ b/log.c
124142
@@ -31,6 +31,7 @@
125143
 #include "SAPI.h"
126144
 #include "ext/standard/datetime.h"
127145
 #include "ext/standard/flock_compat.h"
128146
+#include "main/php_version.h"
129147
130148
 #ifdef HAVE_SYS_SOCKET_H
131149
 #include <sys/socket.h>
132150
@@ -317,7 +318,9 @@
133151
 		zval *result = NULL;
134152
135153
 		long orig_execution_depth = SUHOSIN_G(execution_depth);
136154
+#if PHP_VERSION_ID < 50400
137155
 		zend_bool orig_safe_mode = PG(safe_mode);
138156
+#endif
139157
 		char *orig_basedir = PG(open_basedir);
140158
141159
 		char *phpscript = SUHOSIN_G(log_phpscriptname);
142160
@@ -354,14 +357,18 @@
143161
144162
 				SUHOSIN_G(execution_depth) = 0;
145163
 				if (SUHOSIN_G(log_phpscript_is_safe)) {
146164
+#if PHP_VERSION_ID < 50400
147165
 					PG(safe_mode) = 0;
148166
+#endif
149167
 					PG(open_basedir) = NULL;
150168
 				}
151169
152170
 				zend_execute(new_op_array TSRMLS_CC);
153171
154172
 				SUHOSIN_G(execution_depth) = orig_execution_depth;
155173
+#if PHP_VERSION_ID < 50400
156174
 				PG(safe_mode) = orig_safe_mode;
157175
+#endif
158176
 				PG(open_basedir) = orig_basedir;
159177
160178
 #ifdef ZEND_ENGINE_2
161179
--- a/sha256.c
162180
+++ b/sha256.c
163181
@@ -86,9 +86,11 @@
164182
 		return;
165183
 	}
166184
167185
+#if PHP_VERSION_ID < 50400
168186
 	if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
169187
 		RETURN_FALSE;
170188
 	}
171189
+#endif
172190
173191
 	if (php_check_open_basedir(arg TSRMLS_CC)) {
174192
 		RETURN_FALSE;
175-
@@ -392,7 +394,11 @@
193+
@@ -392,7 +394,7 @@
176194
177195
 /* {{{ suhosin_sha256_functions[]
178196
  */
179-
+#if PHP_VERSION_ID < 50400
197+
-static function_entry suhosin_sha256_functions[] = {
182198
+static zend_function_entry suhosin_sha256_functions[] = {
184199
 	PHP_NAMED_FE(sha256, PHP_FN(suhosin_sha256), NULL)
185200
 	PHP_NAMED_FE(sha256_file, PHP_FN(suhosin_sha256_file), NULL)
186201
 	{NULL, NULL, NULL}
187202
--- a/suhosin.c
188203
+++ b/suhosin.c
189204
@@ -646,12 +646,16 @@
190205
 				array_init(gpc_element);
191206
 				zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
192207
 			} else {
193208
+#if PHP_VERSION_ID < 50400
194209
 				if (PG(magic_quotes_gpc) && (index != var)) {
195210
 					/* no need to addslashes() the index if it's the main variable name */
196211
 					escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
197212
 				} else {
198213
+#endif
199214
 					escaped_index = index;
200215
+#if PHP_VERSION_ID < 50400
201216
 				}
202217
+#endif
203218
 				if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
204219
 					|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
205220
 					MAKE_STD_ZVAL(gpc_element);
206221
@@ -683,11 +687,15 @@
207222
 		if (!index) {
208223
 			zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
209224
 		} else {
210225
+#if PHP_VERSION_ID < 50400
211226
 			if (PG(magic_quotes_gpc)) {
212227
 				escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
213228
 			} else {
214229
+#endif
215230
 				escaped_index = index;
216231
+#if PHP_VERSION_ID < 50400
217232
 			}
218233
+#endif
219234
 			/*
220235
 			 * According to rfc2965, more specific paths are listed above the less specific ones.
221236
 			 * If we encounter a duplicate cookie name, we should skip it, since it is not possible
222237
@@ -714,11 +722,15 @@
223238
224239
 	/* Prepare value */
225240
 	Z_STRLEN(new_entry) = str_len;
226241
+#if PHP_VERSION_ID < 50400
227242
 	if (PG(magic_quotes_gpc)) {
228243
 		Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC);
229244
 	} else {
230245
+#endif
231246
 		Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
232247
+#if PHP_VERSION_ID < 50400
233248
 	}
234249
+#endif
235250
 	Z_TYPE(new_entry) = IS_STRING;
236251
237252
 	suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC);
238253
--- a/ex_imp.c
239254
+++ b/ex_imp.c
240-
@@ -727,7 +727,11 @@
255+
@@ -727,7 +727,7 @@
241256
242257
 /* {{{ suhosin_ex_imp_functions[]
243258
  */
244-
+#if PHP_VERSION_ID < 50400
259+
-function_entry suhosin_ex_imp_functions[] = {
247260
+zend_function_entry suhosin_ex_imp_functions[] = {
249261
 	PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), suhosin_arginfo_extract)
250262
 	PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), suhosin_arginfo_import_request_variables)
251263
 	{NULL, NULL, NULL}
252264

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