From: Michael Wallner Date: Tue, 22 Apr 2014 10:18:44 +0000 (+0200) Subject: Merge branch 'R_2_0' X-Git-Tag: RELEASE_2_1_0_RC1~38 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=5a7615a3e3b5c56471b19941332ba18830778bfb;hp=af622b3219e8037dce34a4e24719cc6408ecad00 Merge branch 'R_2_0' --- diff --git a/php_http_env.c b/php_http_env.c index fdc7b96..30ee32d 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -957,8 +957,11 @@ static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler) size_t json_len = 0; #if PHP_VERSION_ID >= 50600 - php_http_message_body_to_string(php_http_env_get_request_body(TSRMLS_C), - &json_str, &json_len, 0, -1); + if (SG(request_info).request_body) { + /* FG(stream_wrappers) not initialized yet, so we cannot use php://input */ + php_stream_rewind(SG(request_info).request_body); + json_len = php_stream_copy_to_mem(SG(request_info).request_body, &json_str, PHP_STREAM_COPY_ALL, 0); + } #else json_str = SG(request_info).raw_post_data; json_len = SG(request_info).raw_post_data_length; diff --git a/php_http_message.c b/php_http_message.c index a6414e4..0ffdd9e 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -784,7 +784,7 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj) { - TSRMLS_FETCH_FROM_CTX(obj); + TSRMLS_FETCH_FROM_CTX(obj->message->ts); php_http_message_body_addref(obj->message->body); return php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, (void *) &obj->body TSRMLS_CC); diff --git a/php_http_misc.c b/php_http_misc.c index 0515c96..03b9560 100644 --- a/php_http_misc.c +++ b/php_http_misc.c @@ -61,7 +61,8 @@ int php_http_match(const char *haystack_str, const char *needle_str, int flags) result = !strcasecmp(haystack_str, needle_str); } } else { - char *found, *haystack = estrdup(haystack_str), *needle = estrdup(needle_str); + const char *found; + char *haystack = estrdup(haystack_str), *needle = estrdup(needle_str); if (flags & PHP_HTTP_MATCH_CASE) { found = zend_memnstr(haystack, needle, strlen(needle), haystack+strlen(haystack));