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
| 1 | 1 | --- a/execute.c | |
| 2 | 2 | +++ b/execute.c | |
| 3 | 3 | @@ -35,6 +35,7 @@ | |
| 4 | 4 | #include "zend_compile.h" | |
| 5 | 5 | #include "zend_llist.h" | |
| 6 | 6 | #include "SAPI.h" | |
| 7 | 7 | +#include "main/php_version.h" | |
| 8 | 8 | ||
| 9 | 9 | #include "sha256.h" | |
| 10 | 10 | ||
| 11 | 11 | @@ -1031,7 +1032,9 @@ | |
| 12 | 12 | ||
| 13 | 13 | if ((str_length == sizeof("</head>\n")-1) && (strcmp(str, "</head>\n")==0)) { | |
| 14 | 14 | SUHOSIN_G(old_php_body_write)(S_META_ROBOTS, sizeof(S_META_ROBOTS)-1 TSRMLS_CC); | |
| 15 | 15 | +#if PHP_VERSION_ID < 50400 | |
| 16 | 16 | OG(php_body_write) = SUHOSIN_G(old_php_body_write); | |
| 17 | 17 | +#endif | |
| 18 | 18 | return SUHOSIN_G(old_php_body_write)(str, str_length TSRMLS_CC); | |
| 19 | 19 | } else if ((str_length == sizeof(P_META_ROBOTS)-1) && (strcmp(str, P_META_ROBOTS)==0)) { | |
| 20 | 20 | return str_length; | |
| 21 | 21 | @@ -1054,6 +1057,7 @@ | |
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | 24 | /* Andale! Andale! Yee-Hah! */ | |
| 25 | 25 | +#if PHP_VERSION_ID < 50400 | |
| 26 | 26 | php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC); | |
| 27 | 27 | if (!sapi_module.phpinfo_as_text) { | |
| 28 | 28 | SUHOSIN_G(old_php_body_write) = OG(php_body_write); | |
| 29 | 29 | @@ -1061,6 +1065,11 @@ | |
| 30 | 30 | } | |
| 31 | 31 | php_print_info(flag TSRMLS_CC); | |
| 32 | 32 | php_end_ob_buffer(1, 0 TSRMLS_CC); | |
| 33 | 33 | +#else | |
| 34 | 34 | + php_output_start_default(TSRMLS_CC); | |
| 35 | 35 | + php_print_info(flag TSRMLS_CC); | |
| 36 | 36 | + php_output_end(); | |
| 37 | 37 | +#endif | |
| 38 | 38 | ||
| 39 | 39 | RETVAL_TRUE; | |
| 40 | 40 | return (1); | |
| 41 | 41 | @@ -1133,7 +1142,6 @@ | |
| 42 | 42 | retval = 0; | |
| 43 | 43 | } | |
| 44 | 44 | } | |
| 45 | 45 | - | |
| 46 | 46 | RETVAL_BOOL(retval); | |
| 47 | 47 | return (1); | |
| 48 | 48 | } | |
| 49 | 49 | @@ -1523,7 +1531,9 @@ | |
| 50 | 50 | { "srand", ih_srand, NULL, NULL, NULL }, | |
| 51 | 51 | { "mt_srand", ih_mt_srand, NULL, NULL, NULL }, | |
| 52 | 52 | { "rand", ih_rand, NULL, NULL, NULL }, | |
| 53 | 53 | +#if PHP_VERSION_ID < 50400 // Disabled due to segfault | |
| 54 | 54 | { "mt_rand", ih_mt_rand, NULL, NULL, NULL }, | |
| 55 | 55 | +#endif | |
| 56 | 56 | { "getrandmax", ih_getrandmax, NULL, NULL, NULL }, | |
| 57 | 57 | { "mt_getrandmax", ih_getrandmax, NULL, NULL, NULL }, | |
| 58 | 58 | ||
| 59 | 59 | @@ -1538,7 +1548,9 @@ | |
| 60 | 60 | { "fbsql_connect", ih_fixusername, (void *)2, NULL, NULL }, | |
| 61 | 61 | { "fbsql_pconnect", ih_fixusername, (void *)2, NULL, NULL }, | |
| 62 | 62 | ||
| 63 | 63 | +#if PHP_VERSION_ID < 50400 // Disabled due to segfault | |
| 64 | 64 | { "function_exists", ih_function_exists, NULL, NULL, NULL }, | |
| 65 | 65 | +#endif | |
| 66 | 66 | ||
| 67 | 67 | { "ifx_connect", ih_fixusername, (void *)2, NULL, NULL }, | |
| 68 | 68 | { "ifx_pconnect", ih_fixusername, (void *)2, NULL, NULL }, | |
| 69 | 69 | @@ -1606,8 +1618,14 @@ | |
| 70 | 70 | } | |
| 71 | 71 | ||
| 72 | 72 | #ifdef ZEND_ENGINE_2 | |
| 73 | 73 | + | |
| 74 | 74 | +#if PHP_VERSION_ID < 50400 | |
| 75 | 75 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; | |
| 76 | 76 | #else | |
| 77 | 77 | + return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->extended_value)).var.ptr; | |
| 78 | 78 | +#endif | |
| 79 | 79 | + | |
| 80 | 80 | +#else | |
| 81 | 81 | return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr; | |
| 82 | 82 | #endif | |
| 83 | 83 | ht = execute_data_ptr->opline->extended_value; | |
| 84 | 84 | --- a/rfc1867.c | |
| 85 | 85 | +++ b/rfc1867.c | |
| 86 | 86 | @@ -35,6 +35,7 @@ | |
| 87 | 87 | #include "suhosin_rfc1867.h" | |
| 88 | 88 | #include "php_ini.h" | |
| 89 | 89 | #include "ext/standard/php_string.h" | |
| 90 | 90 | +#include "main/php_version.h" | |
| 91 | 91 | ||
| 92 | 92 | #define DEBUG_FILE_UPLOAD ZEND_DEBUG | |
| 93 | 93 | ||
| 94 | 94 | @@ -244,21 +245,29 @@ | |
| 95 | 95 | ||
| 96 | 96 | static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) | |
| 97 | 97 | { | |
| 98 | 98 | +#if PHP_VERSION_ID < 50400 | |
| 99 | 99 | int register_globals = PG(register_globals); | |
| 100 | 100 | ||
| 101 | 101 | PG(register_globals) = 0; | |
| 102 | 102 | +#endif | |
| 103 | 103 | safe_php_register_variable(strvar, val, http_post_files, override_protection TSRMLS_CC); | |
| 104 | 104 | +#if PHP_VERSION_ID < 50400 | |
| 105 | 105 | PG(register_globals) = register_globals; | |
| 106 | 106 | +#endif | |
| 107 | 107 | } | |
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | 110 | static void register_http_post_files_variable_ex(char *var, zval *val, zval *http_post_files, zend_bool override_protection TSRMLS_DC) | |
| 111 | 111 | { | |
| 112 | 112 | +#if PHP_VERSION_ID < 50400 | |
| 113 | 113 | int register_globals = PG(register_globals); | |
| 114 | 114 | ||
| 115 | 115 | PG(register_globals) = 0; | |
| 116 | 116 | +#endif | |
| 117 | 117 | safe_php_register_variable_ex(var, val, http_post_files, override_protection TSRMLS_CC); | |
| 118 | 118 | +#if PHP_VERSION_ID < 50400 | |
| 119 | 119 | PG(register_globals) = register_globals; | |
| 120 | 120 | +#endif | |
| 121 | 121 | } | |
| 122 | 122 | ||
| 123 | 123 | /* | |
| 124 | 124 | --- a/session.c | |
| 125 | 125 | +++ b/session.c | |
| 126 | 126 | @@ -33,6 +33,7 @@ | |
| 127 | 127 | #include "ext/standard/php_smart_str.h" | |
| 128 | 128 | #include "ext/standard/php_var.h" | |
| 129 | 129 | #include "sha256.h" | |
| 130 | 130 | +#include "main/php_version.h" | |
| 131 | 131 | ||
| 132 | 132 | #include <fcntl.h> | |
| 133 | 133 | ||
| 134 | 134 | @@ -294,6 +295,7 @@ | |
| 135 | 135 | if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { | |
| 136 | 136 | ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); | |
| 137 | 137 | ||
| 138 | 138 | +#if PHP_VERSION_ID < 50400 | |
| 139 | 139 | /* If register_globals is enabled, and | |
| 140 | 140 | * if there is an entry for the slot in $_SESSION, and | |
| 141 | 141 | * if that entry is still set to NULL, and | |
| 142 | 142 | @@ -307,6 +309,7 @@ | |
| 143 | 143 | *state_var = tmp; | |
| 144 | 144 | } | |
| 145 | 145 | } | |
| 146 | 146 | +#endif | |
| 147 | 147 | } | |
| 148 | 148 | return ret; | |
| 149 | 149 | } | |
| 150 | 150 | --- a/log.c | |
| 151 | 151 | +++ b/log.c | |
| 152 | 152 | @@ -31,6 +31,7 @@ | |
| 153 | 153 | #include "SAPI.h" | |
| 154 | 154 | #include "ext/standard/datetime.h" | |
| 155 | 155 | #include "ext/standard/flock_compat.h" | |
| 156 | 156 | +#include "main/php_version.h" | |
| 157 | 157 | ||
| 158 | 158 | #ifdef HAVE_SYS_SOCKET_H | |
| 159 | 159 | #include <sys/socket.h> | |
| 160 | 160 | @@ -317,7 +318,9 @@ | |
| 161 | 161 | zval *result = NULL; | |
| 162 | 162 | ||
| 163 | 163 | long orig_execution_depth = SUHOSIN_G(execution_depth); | |
| 164 | 164 | +#if PHP_VERSION_ID < 50400 | |
| 165 | 165 | zend_bool orig_safe_mode = PG(safe_mode); | |
| 166 | 166 | +#endif | |
| 167 | 167 | char *orig_basedir = PG(open_basedir); | |
| 168 | 168 | ||
| 169 | 169 | char *phpscript = SUHOSIN_G(log_phpscriptname); | |
| 170 | 170 | @@ -354,14 +357,18 @@ | |
| 171 | 171 | ||
| 172 | 172 | SUHOSIN_G(execution_depth) = 0; | |
| 173 | 173 | if (SUHOSIN_G(log_phpscript_is_safe)) { | |
| 174 | 174 | +#if PHP_VERSION_ID < 50400 | |
| 175 | 175 | PG(safe_mode) = 0; | |
| 176 | 176 | +#endif | |
| 177 | 177 | PG(open_basedir) = NULL; | |
| 178 | 178 | } | |
| 179 | 179 | ||
| 180 | 180 | zend_execute(new_op_array TSRMLS_CC); | |
| 181 | 181 | ||
| 182 | 182 | SUHOSIN_G(execution_depth) = orig_execution_depth; | |
| 183 | 183 | +#if PHP_VERSION_ID < 50400 | |
| 184 | 184 | PG(safe_mode) = orig_safe_mode; | |
| 185 | 185 | +#endif | |
| 186 | 186 | PG(open_basedir) = orig_basedir; | |
| 187 | 187 | ||
| 188 | 188 | #ifdef ZEND_ENGINE_2 | |
| 189 | 189 | --- a/sha256.c | |
| 190 | 190 | +++ b/sha256.c | |
| 191 | 191 | @@ -86,9 +86,11 @@ | |
| 192 | 192 | return; | |
| 193 | 193 | } | |
| 194 | 194 | ||
| 195 | 195 | +#if PHP_VERSION_ID < 50400 | |
| 196 | 196 | if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { | |
| 197 | 197 | RETURN_FALSE; | |
| 198 | 198 | } | |
| 199 | 199 | +#endif | |
| 200 | 200 | ||
| 201 | 201 | if (php_check_open_basedir(arg TSRMLS_CC)) { | |
| 202 | 202 | RETURN_FALSE; | |
| 203 | 203 | @@ -392,7 +394,7 @@ | |
| 204 | 204 | ||
| 205 | 205 | /* {{{ suhosin_sha256_functions[] | |
| 206 | 206 | */ | |
| 207 | 207 | -static function_entry suhosin_sha256_functions[] = { | |
| 208 | 208 | +static zend_function_entry suhosin_sha256_functions[] = { | |
| 209 | 209 | PHP_NAMED_FE(sha256, PHP_FN(suhosin_sha256), NULL) | |
| 210 | 210 | PHP_NAMED_FE(sha256_file, PHP_FN(suhosin_sha256_file), NULL) | |
| 211 | 211 | {NULL, NULL, NULL} | |
| 212 | 212 | --- a/suhosin.c | |
| 213 | 213 | +++ b/suhosin.c | |
| 214 | 214 | @@ -646,12 +646,16 @@ | |
| 215 | 215 | array_init(gpc_element); | |
| 216 | 216 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); | |
| 217 | 217 | } else { | |
| 218 | 218 | +#if PHP_VERSION_ID < 50400 | |
| 219 | 219 | if (PG(magic_quotes_gpc) && (index != var)) { | |
| 220 | 220 | /* no need to addslashes() the index if it's the main variable name */ | |
| 221 | 221 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); | |
| 222 | 222 | } else { | |
| 223 | 223 | +#endif | |
| 224 | 224 | escaped_index = index; | |
| 225 | 225 | +#if PHP_VERSION_ID < 50400 | |
| 226 | 226 | } | |
| 227 | 227 | +#endif | |
| 228 | 228 | if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE | |
| 229 | 229 | || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { | |
| 230 | 230 | MAKE_STD_ZVAL(gpc_element); | |
| 231 | 231 | @@ -683,11 +687,15 @@ | |
| 232 | 232 | if (!index) { | |
| 233 | 233 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); | |
| 234 | 234 | } else { | |
| 235 | 235 | +#if PHP_VERSION_ID < 50400 | |
| 236 | 236 | if (PG(magic_quotes_gpc)) { | |
| 237 | 237 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); | |
| 238 | 238 | } else { | |
| 239 | 239 | +#endif | |
| 240 | 240 | escaped_index = index; | |
| 241 | 241 | +#if PHP_VERSION_ID < 50400 | |
| 242 | 242 | } | |
| 243 | 243 | +#endif | |
| 244 | 244 | /* | |
| 245 | 245 | * According to rfc2965, more specific paths are listed above the less specific ones. | |
| 246 | 246 | * If we encounter a duplicate cookie name, we should skip it, since it is not possible | |
| 247 | 247 | @@ -714,11 +722,15 @@ | |
| 248 | 248 | ||
| 249 | 249 | /* Prepare value */ | |
| 250 | 250 | Z_STRLEN(new_entry) = str_len; | |
| 251 | 251 | +#if PHP_VERSION_ID < 50400 | |
| 252 | 252 | if (PG(magic_quotes_gpc)) { | |
| 253 | 253 | Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC); | |
| 254 | 254 | } else { | |
| 255 | 255 | +#endif | |
| 256 | 256 | Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); | |
| 257 | 257 | +#if PHP_VERSION_ID < 50400 | |
| 258 | 258 | } | |
| 259 | 259 | +#endif | |
| 260 | 260 | Z_TYPE(new_entry) = IS_STRING; | |
| 261 | 261 | ||
| 262 | 262 | suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC); | |
| 263 | 263 | --- a/ex_imp.c | |
| 264 | 264 | +++ b/ex_imp.c | |
| 265 | 265 | @@ -727,7 +727,7 @@ | |
| 266 | 266 | ||
| 267 | 267 | /* {{{ suhosin_ex_imp_functions[] | |
| 268 | 268 | */ | |
| 269 | 269 | -function_entry suhosin_ex_imp_functions[] = { | |
| 270 | 270 | +zend_function_entry suhosin_ex_imp_functions[] = { | |
| 271 | 271 | PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), suhosin_arginfo_extract) | |
| 272 | 272 | PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), suhosin_arginfo_import_request_variables) | |
| 273 | 273 | {NULL, NULL, NULL} | |
| 274 | 274 |
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.
kpaste.net RSS