Permalink
Browse files

Fixed bug #41293 (Fixed creation of HTTP_RAW_POST_DATA when there is no

default post handler).
  • Loading branch information...
1 parent 636806a commit f932fe5ad434a44b66c3b31d6ecb4d9ed8da05ae Ilia Alshanetsky committed May 6, 2007
Showing with 10 additions and 11 deletions.
  1. +2 −0 NEWS
  2. +8 −11 main/php_content_types.c
View
@@ -5,6 +5,8 @@ PHP NEWS
(Ilia)
- Fixed altering $this via argument named "this". (Dmitry)
- Fixed PHP CLI to use the php.ini from the binary location. (Hannes)
+- Fixed bug #41293 (Fixed creation of HTTP_RAW_POST_DATA when there is no
+ default post handler). (Ilia)
- Fixed bug #41287 (Namespace functions don't allow xmlns defintion to be
optional). (Rob)
- Fixed bug #41285 (Improved fix for CVE-2007-1887 to work with non-bundled
@@ -37,21 +37,19 @@ static sapi_post_entry php_post_entries[] = {
*/
SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
{
- char *data = NULL;
- int length = 0;
+ char *data;
+ int length;
/* $HTTP_RAW_POST_DATA registration */
- if(!strcmp(SG(request_info).request_method, "POST")) {
- if(NULL == SG(request_info).post_entry && SG(request_info).post_data) {
+ if (!strcmp(SG(request_info).request_method, "POST")) {
+ if (NULL == SG(request_info).post_entry) {
/* no post handler registered, so we just swallow the data */
sapi_read_standard_form_data(TSRMLS_C);
+ }
+
+ if (PG(always_populate_raw_post_data) && SG(request_info).post_data) {
length = SG(request_info).post_data_length;
data = estrndup(SG(request_info).post_data, length);
- } else if(PG(always_populate_raw_post_data) && SG(request_info).post_data) {
- length = SG(request_info).post_data_length;
- data = estrndup(SG(request_info).post_data, length);
- }
- if(data) {
SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length);
}
}
@@ -62,11 +60,10 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
in the long run post handlers should be changed to not touch
request_info.post_data for memory preservation reasons
*/
- if(SG(request_info).post_data) {
+ if (SG(request_info).post_data) {
SG(request_info).raw_post_data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
SG(request_info).raw_post_data_length = SG(request_info).post_data_length;
}
-
}
/* }}} */

0 comments on commit f932fe5

Please sign in to comment.