summaryrefslogtreecommitdiff
path: root/post_handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'post_handler.c')
-rw-r--r--post_handler.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/post_handler.c b/post_handler.c
index 267dfcb..7c678f4 100644
--- a/post_handler.c
+++ b/post_handler.c
@@ -130,9 +130,7 @@ static PHP_INI_MH(suhosin_OnUpdate_mbstring_encoding_translation)
130 */ 130 */
131static sapi_post_entry suhosin_post_entries[] = { 131static sapi_post_entry suhosin_post_entries[] = {
132 { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, suhosin_std_post_handler }, 132 { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, suhosin_std_post_handler },
133#if PHP_VERSION_ID < 50400
134 { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, suhosin_rfc1867_post_handler }, 133 { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, suhosin_rfc1867_post_handler },
135#endif
136 { NULL, 0, NULL, NULL } 134 { NULL, 0, NULL, NULL }
137}; 135};
138/* }}} */ 136/* }}} */
@@ -141,15 +139,7 @@ void suhosin_hook_post_handlers(TSRMLS_D)
141{ 139{
142 HashTable tempht; 140 HashTable tempht;
143 zend_ini_entry *ini_entry; 141 zend_ini_entry *ini_entry;
144 142
145 old_rfc1867_callback = php_rfc1867_callback;
146
147#if PHP_VERSION_ID >= 50400
148 /* the RFC1867 code is now good enough in PHP to handle our filter just as a registered callback */
149 php_rfc1867_callback = suhosin_rfc1867_filter;
150 sapi_unregister_post_entry(&suhosin_post_entries[0] TSRMLS_CC);
151 sapi_register_post_entries(suhosin_post_entries TSRMLS_CC);
152#else
153#if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0) 143#if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0)
154 sapi_unregister_post_entry(&suhosin_post_entries[0] TSRMLS_CC); 144 sapi_unregister_post_entry(&suhosin_post_entries[0] TSRMLS_CC);
155 sapi_unregister_post_entry(&suhosin_post_entries[1] TSRMLS_CC); 145 sapi_unregister_post_entry(&suhosin_post_entries[1] TSRMLS_CC);
@@ -159,7 +149,7 @@ void suhosin_hook_post_handlers(TSRMLS_D)
159 sapi_unregister_post_entry(&suhosin_post_entries[1]); 149 sapi_unregister_post_entry(&suhosin_post_entries[1]);
160 sapi_register_post_entries(suhosin_post_entries); 150 sapi_register_post_entries(suhosin_post_entries);
161#endif 151#endif
162#endif 152
163 /* we want to get notified if another extension deregisters the suhosin post handlers */ 153 /* we want to get notified if another extension deregisters the suhosin post handlers */
164 154
165 /* we need to tell suhosin patch that there is a new valid destructor */ 155 /* we need to tell suhosin patch that there is a new valid destructor */
@@ -182,10 +172,6 @@ void suhosin_unhook_post_handlers(TSRMLS_D)
182{ 172{
183 zend_ini_entry *ini_entry; 173 zend_ini_entry *ini_entry;
184 174
185#if PHP_VERSION_ID >= 50400
186 /* unhook the php_rfc1867_callback */
187 php_rfc1867_callback = old_rfc1867_callback;
188#endif
189 /* Restore to an empty destructor */ 175 /* Restore to an empty destructor */
190 SG(known_post_content_types).pDestructor = NULL; 176 SG(known_post_content_types).pDestructor = NULL;
191 177