diff options
| author | Stefan Esser | 2012-04-13 15:37:11 +0200 |
|---|---|---|
| committer | Stefan Esser | 2012-04-13 15:37:11 +0200 |
| commit | b71aff4f357e276efa7010a97b61bd1d63cd7fbb (patch) | |
| tree | 33087e1f0a3543f83ec006a30ef8f0304f4a77d9 /suhosin.c | |
| parent | 6b00f2346c2529a9169cf1c04580e293a77f6a71 (diff) | |
Initial PHP 5.4.0 compatibility
Diffstat (limited to 'suhosin.c')
| -rw-r--r-- | suhosin.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -649,12 +649,16 @@ static void suhosin_register_cookie_variable(char *var, zval *val, zval *track_v | |||
| 649 | array_init(gpc_element); | 649 | array_init(gpc_element); |
| 650 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); | 650 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); |
| 651 | } else { | 651 | } else { |
| 652 | #if PHP_VERSION_ID < 50400 | ||
| 652 | if (PG(magic_quotes_gpc) && (index != var)) { | 653 | if (PG(magic_quotes_gpc) && (index != var)) { |
| 653 | /* no need to addslashes() the index if it's the main variable name */ | 654 | /* no need to addslashes() the index if it's the main variable name */ |
| 654 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); | 655 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); |
| 655 | } else { | 656 | } else { |
| 657 | #endif | ||
| 656 | escaped_index = index; | 658 | escaped_index = index; |
| 659 | #if PHP_VERSION_ID < 50400 | ||
| 657 | } | 660 | } |
| 661 | #endif | ||
| 658 | if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE | 662 | if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE |
| 659 | || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { | 663 | || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { |
| 660 | MAKE_STD_ZVAL(gpc_element); | 664 | MAKE_STD_ZVAL(gpc_element); |
| @@ -686,11 +690,15 @@ plain_var: | |||
| 686 | if (!index) { | 690 | if (!index) { |
| 687 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); | 691 | zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); |
| 688 | } else { | 692 | } else { |
| 693 | #if PHP_VERSION_ID < 50400 | ||
| 689 | if (PG(magic_quotes_gpc)) { | 694 | if (PG(magic_quotes_gpc)) { |
| 690 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); | 695 | escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); |
| 691 | } else { | 696 | } else { |
| 697 | #endif | ||
| 692 | escaped_index = index; | 698 | escaped_index = index; |
| 699 | #if PHP_VERSION_ID < 50400 | ||
| 693 | } | 700 | } |
| 701 | #endif | ||
| 694 | /* | 702 | /* |
| 695 | * According to rfc2965, more specific paths are listed above the less specific ones. | 703 | * According to rfc2965, more specific paths are listed above the less specific ones. |
| 696 | * If we encounter a duplicate cookie name, we should skip it, since it is not possible | 704 | * If we encounter a duplicate cookie name, we should skip it, since it is not possible |
| @@ -717,11 +725,15 @@ static void suhosin_register_cookie_variable_safe(char *var, char *strval, int s | |||
| 717 | 725 | ||
| 718 | /* Prepare value */ | 726 | /* Prepare value */ |
| 719 | Z_STRLEN(new_entry) = str_len; | 727 | Z_STRLEN(new_entry) = str_len; |
| 728 | #if PHP_VERSION_ID < 50400 | ||
| 720 | if (PG(magic_quotes_gpc)) { | 729 | if (PG(magic_quotes_gpc)) { |
| 721 | Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC); | 730 | Z_STRVAL(new_entry) = php_addslashes(strval, Z_STRLEN(new_entry), &Z_STRLEN(new_entry), 0 TSRMLS_CC); |
| 722 | } else { | 731 | } else { |
| 732 | #endif | ||
| 723 | Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); | 733 | Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry)); |
| 734 | #if PHP_VERSION_ID < 50400 | ||
| 724 | } | 735 | } |
| 736 | #endif | ||
| 725 | Z_TYPE(new_entry) = IS_STRING; | 737 | Z_TYPE(new_entry) = IS_STRING; |
| 726 | 738 | ||
| 727 | suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC); | 739 | suhosin_register_cookie_variable(var, &new_entry, track_vars_array TSRMLS_CC); |
