pastebin - collaborative debugging tool
kpaste.net RSS

Difference between
modified post 4ee by Anonymous on Mon 9th Apr 2012 13:50
original post 27ebe7 by Anonymous on Mon 9th Apr 2012 13:49
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
 }
49-
@@ -1538,7 +1546,9 @@
49+
@@ -1523,7 +1531,9 @@
50-
     { "fbsql_connect", ih_fixusername, (void *)2, NULL, NULL },
50+
 	{ "srand", ih_srand, NULL, NULL, NULL },
51-
     { "fbsql_pconnect", ih_fixusername, (void *)2, NULL, NULL },
51+
 	{ "mt_srand", ih_mt_srand, NULL, NULL, NULL },
52+
 	{ "rand", ih_rand, NULL, NULL, NULL },
5353
+#if PHP_VERSION_ID < 50400 // Disabled due to segfault
54-
     { "function_exists", ih_function_exists, NULL, NULL, NULL },
54+
 	{ "mt_rand", ih_mt_rand, NULL, NULL, NULL },
5555
+#endif
56+
 	{ "getrandmax", ih_getrandmax, NULL, NULL, NULL },
5658
59+
@@ -1538,7 +1548,9 @@
6162
63+
+#if PHP_VERSION_ID < 50400 // Disabled due to segfault
6865
+#endif
66+
6973
+
74+
+#if PHP_VERSION_ID < 50400
7080
+#else
7181
         return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr;
7282
 #endif
7383
 	ht = execute_data_ptr->opline->extended_value;
7484
--- a/rfc1867.c
7585
+++ b/rfc1867.c
7686
@@ -35,6 +35,7 @@
7787
 #include "suhosin_rfc1867.h"
7888
 #include "php_ini.h"
7989
 #include "ext/standard/php_string.h"
8090
+#include "main/php_version.h"
8191
8292
 #define DEBUG_FILE_UPLOAD ZEND_DEBUG
8393
8494
@@ -244,21 +245,29 @@
8595
8696
 static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
8797
 {
8898
+#if PHP_VERSION_ID < 50400
8999
 	int register_globals = PG(register_globals);
90100
91101
 	PG(register_globals) = 0;
92102
+#endif
93103
 	safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC);
94104
+#if PHP_VERSION_ID < 50400
95105
 	PG(register_globals) = register_globals;
96106
+#endif
97107
 }
98108
99109
100110
 static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC)
101111
 {
102112
+#if PHP_VERSION_ID < 50400
103113
 	int register_globals = PG(register_globals);
104114
105115
 	PG(register_globals) = 0;
106116
+#endif
107117
 	safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC);
108118
+#if PHP_VERSION_ID < 50400
109119
 	PG(register_globals) = register_globals;
110120
+#endif
111121
 }
112122
113123
 /*
114124
--- a/session.c
115125
+++ b/session.c
116126
@@ -33,6 +33,7 @@
117127
 #include "ext/standard/php_smart_str.h"
118128
 #include "ext/standard/php_var.h"
119129
 #include "sha256.h"
120130
+#include "main/php_version.h"
121131
122132
 #include <fcntl.h>
123133
124134
@@ -294,6 +295,7 @@
125135
     if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) {
126136
         ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var);
127137
128138
+#if PHP_VERSION_ID < 50400
129139
         /* If register_globals is enabled, and
130140
          * if there is an entry for the slot in $_SESSION, and
131141
          * if that entry is still set to NULL, and
132142
@@ -307,6 +309,7 @@
133143
                 *state_var = tmp;
134144
             }
135145
         }
136146
+#endif
137147
     }
138148
     return ret;
139149
 }
140150
--- a/log.c
141151
+++ b/log.c
142152
@@ -31,6 +31,7 @@
143153
 #include "SAPI.h"
144154
 #include "ext/standard/datetime.h"
145155
 #include "ext/standard/flock_compat.h"
146156
+#include "main/php_version.h"
147157
148158
 #ifdef HAVE_SYS_SOCKET_H
149159
 #include <sys/socket.h>
150160
@@ -317,7 +318,9 @@
151161
 		zval *result = NULL;
152162
153163
 		long orig_execution_depth = SUHOSIN_G(execution_depth);
154164
+#if PHP_VERSION_ID < 50400
155165
 		zend_bool orig_safe_mode = PG(safe_mode);
156166
+#endif
157167
 		char *orig_basedir = PG(open_basedir);
158168
159169
 		char *phpscript = SUHOSIN_G(log_phpscriptname);
160170
@@ -354,14 +357,18 @@
161171
162172
 				SUHOSIN_G(execution_depth) = 0;
163173
 				if (SUHOSIN_G(log_phpscript_is_safe)) {
164174
+#if PHP_VERSION_ID < 50400
165175
 					PG(safe_mode) = 0;
166176
+#endif
167177
 					PG(open_basedir) = NULL;
168178
 				}
169179
170180
 				zend_execute(new_op_array TSRMLS_CC);
171181
172182
 				SUHOSIN_G(execution_depth) = orig_execution_depth;
173183
+#if PHP_VERSION_ID < 50400
174184
 				PG(safe_mode) = orig_safe_mode;
175185
+#endif
176186
 				PG(open_basedir) = orig_basedir;
177187
178188
 #ifdef ZEND_ENGINE_2
179189
--- a/sha256.c
180190
+++ b/sha256.c
181191
@@ -86,9 +86,11 @@
182192
 		return;
183193
 	}
184194
185195
+#if PHP_VERSION_ID < 50400
186196
 	if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
187197
 		RETURN_FALSE;
188198
 	}
189199
+#endif
190200
191201
 	if (php_check_open_basedir(arg TSRMLS_CC)) {
192202
 		RETURN_FALSE;
193203
@@ -392,7 +394,7 @@
194204
195205
 /* {{{ suhosin_sha256_functions[]
196206
  */
197207
-static function_entry suhosin_sha256_functions[] = {
198208
+static zend_function_entry suhosin_sha256_functions[] = {
199209
 	PHP_NAMED_FE(sha256, PHP_FN(suhosin_sha256), NULL)
200210
 	PHP_NAMED_FE(sha256_file, PHP_FN(suhosin_sha256_file), NULL)
201211
 	{NULL, NULL, NULL}
202212
--- a/suhosin.c
203213
+++ b/suhosin.c
204214
@@ -646,12 +646,16 @@
205215
 				array_init(gpc_element);
206216
 				zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
207217
 			} else {
208218
+#if PHP_VERSION_ID < 50400
209219
 				if (PG(magic_quotes_gpc) && (index != var)) {
210220
 					/* no need to addslashes() the index if it's the main variable name */
211221
 					escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
212222
 				} else {
213223
+#endif
214224
 					escaped_index = index;
215225
+#if PHP_VERSION_ID < 50400
216226
 				}
217227
+#endif
218228
 				if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
219229
 					|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
220230
 					MAKE_STD_ZVAL(gpc_element);
221231
@@ -683,11 +687,15 @@
222232
 		if (!index) {
223233
 			zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
224234
 		} else {
225235
+#if PHP_VERSION_ID < 50400
226236
 			if (PG(magic_quotes_gpc)) {
227237
 				escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC);
228238
 			} else {
229239
+#endif
230240
 				escaped_index = index;
231241
+#if PHP_VERSION_ID < 50400
232242
 			}
233243
+#endif
234244
 			/*
235245
 			 * According to rfc2965, more specific paths are listed above the less specific ones.
236246
 			 * If we encounter a duplicate cookie name, we should skip it, since it is not possible
237247
@@ -714,11 +722,15 @@
238248
239249
 	/* Prepare value */
240250
 	Z_STRLEN(new_entry) = str_len;
241251
+#if PHP_VERSION_ID < 50400
242252
 	if (PG(magic_quotes_gpc)) {
243253
 		Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC);
244254
 	} else {
245255
+#endif
246256
 		Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
247257
+#if PHP_VERSION_ID < 50400
248258
 	}
249259
+#endif
250260
 	Z_TYPE(new_entry) = IS_STRING;
251261
252262
 	suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC);
253263
--- a/ex_imp.c
254264
+++ b/ex_imp.c
255265
@@ -727,7 +727,7 @@
256266
257267
 /* {{{ suhosin_ex_imp_functions[]
258268
  */
259269
-function_entry suhosin_ex_imp_functions[] = {
260270
+zend_function_entry suhosin_ex_imp_functions[] = {
261271
 	PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), suhosin_arginfo_extract)
262272
 	PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), suhosin_arginfo_import_request_variables)
263273
 	{NULL, NULL, NULL}
264274

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