diff options
| author | Stefan | 2010-03-24 18:10:10 +0100 |
|---|---|---|
| committer | Stefan | 2010-03-24 18:10:10 +0100 |
| commit | 799405fc1cad4bfa4fc386ea4e46cad25b515b1d (patch) | |
| tree | bb867d67d29eb8f02ed8854b7deca514137e05a0 /header.c | |
| parent | b88687640649423e30c4bf8bb9808bc8acf592a3 (diff) | |
Fixed suhosin_header_handler to be PHP 5.3.x compatible
Diffstat (limited to 'header.c')
| -rw-r--r-- | header.c | 20 |
1 files changed, 19 insertions, 1 deletions
| @@ -32,7 +32,11 @@ | |||
| 32 | #include "SAPI.h" | 32 | #include "SAPI.h" |
| 33 | #include "php_variables.h" | 33 | #include "php_variables.h" |
| 34 | 34 | ||
| 35 | #if PHP_VERSION_ID >= 50300 | ||
| 36 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; | ||
| 37 | #else | ||
| 35 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; | 38 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; |
| 39 | #endif | ||
| 36 | 40 | ||
| 37 | char *suhosin_encrypt_single_cookie(char *name, int name_len, char *value, int value_len, char *key TSRMLS_DC) | 41 | char *suhosin_encrypt_single_cookie(char *name, int name_len, char *value, int value_len, char *key TSRMLS_DC) |
| 38 | { | 42 | { |
| @@ -221,10 +225,20 @@ char *suhosin_cookie_decryptor(TSRMLS_D) | |||
| 221 | 225 | ||
| 222 | /* {{{ suhosin_header_handler | 226 | /* {{{ suhosin_header_handler |
| 223 | */ | 227 | */ |
| 228 | #if PHP_VERSION_ID >= 50300 | ||
| 229 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) | ||
| 230 | #else | ||
| 224 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) | 231 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) |
| 232 | #endif | ||
| 225 | { | 233 | { |
| 226 | int retval = SAPI_HEADER_ADD, i; | 234 | int retval = SAPI_HEADER_ADD, i; |
| 227 | char *tmp; | 235 | char *tmp; |
| 236 | |||
| 237 | #if PHP_VERSION_ID >= 50300 | ||
| 238 | if (op != SAPI_HEADER_ADD && op != SAPI_HEADER_REPLACE) { | ||
| 239 | goto suhosin_skip_header_handling; | ||
| 240 | } | ||
| 241 | #endif | ||
| 228 | 242 | ||
| 229 | if (!SUHOSIN_G(allow_multiheader) && sapi_header && sapi_header->header) { | 243 | if (!SUHOSIN_G(allow_multiheader) && sapi_header && sapi_header->header) { |
| 230 | 244 | ||
| @@ -309,10 +323,14 @@ int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct | |||
| 309 | sapi_header->header_len = len; | 323 | sapi_header->header_len = len; |
| 310 | } | 324 | } |
| 311 | 325 | ||
| 312 | 326 | suhosin_skip_header_handling: | |
| 313 | /* If existing call the sapi header handler */ | 327 | /* If existing call the sapi header handler */ |
| 314 | if (orig_header_handler) { | 328 | if (orig_header_handler) { |
| 329 | #if PHP_VERSION_ID >= 50300 | ||
| 330 | retval = orig_header_handler(sapi_header, op, sapi_headers TSRMLS_CC); | ||
| 331 | #else | ||
| 315 | retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC); | 332 | retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC); |
| 333 | #endif | ||
| 316 | } | 334 | } |
| 317 | 335 | ||
| 318 | return retval; | 336 | return retval; |
