summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/mysqli/mysqli_priv.h2
-rw-r--r--ext/session/tests/031.phpt1
-rw-r--r--ext/session/tests/session_set_save_handler_class_005.phpt1
-rw-r--r--ext/session/tests/session_set_save_handler_class_012.phpt1
-rw-r--r--ext/standard/php_fopen_wrapper.c23
-rw-r--r--main/SAPI.c2
-rw-r--r--tests/basic/bug67198.phpt42
8 files changed, 60 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 55d6cbbfc5..5fe882b1d0 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PHP NEWS
- Core:
. Fixed bug #67169 (array_splice all elements, then []= gives wrong index).
(Nikita)
+ . Fixed bug #67198 (php://input regression). (Mike)
01 May 2014, PHP 5.6.0 Beta 2
diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h
index e5fcc0986c..2b038d7ab6 100644
--- a/ext/mysqli/mysqli_priv.h
+++ b/ext/mysqli/mysqli_priv.h
@@ -118,7 +118,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * TSRML
#else
/* libmysql */
#define MYSQLI_ASYNC 0
-#define MYSQLI_STORE_RESULT_OFS 0
+#define MYSQLI_STORE_RESULT_COPY_DATA 0
#endif
/* for mysqli_fetch_assoc */
diff --git a/ext/session/tests/031.phpt b/ext/session/tests/031.phpt
index e8deb3dac5..7486c4b866 100644
--- a/ext/session/tests/031.phpt
+++ b/ext/session/tests/031.phpt
@@ -2,6 +2,7 @@
setting hash_function to sha512 and hash_bits_per_character > 4 should not crash
--SKIPIF--
<?php include('skipif.inc'); ?>
+<?php if (!extension_loaded('hash')) die('skip hash extension not available'); ?>
--INI--
session.use_cookies=0
session.cache_limiter=
diff --git a/ext/session/tests/session_set_save_handler_class_005.phpt b/ext/session/tests/session_set_save_handler_class_005.phpt
index a996eb8d26..c74c81de1d 100644
--- a/ext/session/tests/session_set_save_handler_class_005.phpt
+++ b/ext/session/tests/session_set_save_handler_class_005.phpt
@@ -3,6 +3,7 @@ Test session_set_save_handler() : incomplete implementation
--INI--
session.save_handler=files
session.name=PHPSESSID
+session.gc_probability=0
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt
index 706ef793ef..3899d28816 100644
--- a/ext/session/tests/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/session_set_save_handler_class_012.phpt
@@ -3,6 +3,7 @@ Test session_set_save_handler() : incorrect arguments for existing handler open
--INI--
session.save_handler=files
session.name=PHPSESSID
+session.gc_probability=0
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 583ccdc232..9d6b4eafe7 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -64,7 +64,7 @@ php_stream_ops php_stream_output_ops = {
};
typedef struct php_stream_input { /* {{{ */
- php_stream **body_ptr;
+ php_stream *body;
zend_off_t position;
} php_stream_input_t;
/* }}} */
@@ -85,13 +85,13 @@ static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count
int read_bytes = sapi_read_post_block(buf, count TSRMLS_CC);
if (read_bytes > 0) {
- php_stream_seek(*input->body_ptr, 0, SEEK_END);
- php_stream_write(*input->body_ptr, buf, read_bytes);
+ php_stream_seek(input->body, 0, SEEK_END);
+ php_stream_write(input->body, buf, read_bytes);
}
}
- php_stream_seek(*input->body_ptr, input->position, SEEK_SET);
- read = php_stream_read(*input->body_ptr, buf, count);
+ php_stream_seek(input->body, input->position, SEEK_SET);
+ read = php_stream_read(input->body, buf, count);
if (!read || read == (size_t) -1) {
stream->eof = 1;
@@ -122,9 +122,9 @@ static int php_stream_input_seek(php_stream *stream, zend_off_t offset, int when
{
php_stream_input_t *input = stream->abstract;
- if (*input->body_ptr) {
- int sought = php_stream_seek(*input->body_ptr, offset, whence);
- *newoffset = (*input->body_ptr)->position;
+ if (input->body) {
+ int sought = php_stream_seek(input->body, offset, whence);
+ *newoffset = (input->body)->position;
return sought;
}
@@ -228,10 +228,11 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
}
input = ecalloc(1, sizeof(*input));
- if (*(input->body_ptr = &SG(request_info).request_body)) {
- php_stream_rewind(*input->body_ptr);
+ if ((input->body = SG(request_info).request_body)) {
+ php_stream_rewind(input->body);
} else {
- *input->body_ptr = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE);
+ input->body = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE);
+ SG(request_info).request_body = input->body;
}
return php_stream_alloc(&php_stream_input_ops, input, 0, "rb");
diff --git a/main/SAPI.c b/main/SAPI.c
index cbaa25ee9e..2e1fe97314 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -462,7 +462,7 @@ SAPI_API void sapi_activate(TSRMLS_D)
SG(request_info).post_entry = NULL;
SG(request_info).proto_num = 1000; /* Default to HTTP 1.0 */
SG(global_request_time) = 0;
-
+ SG(post_read) = 0;
/* It's possible to override this general case in the activate() callback, if necessary. */
if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
SG(request_info).headers_only = 1;
diff --git a/tests/basic/bug67198.phpt b/tests/basic/bug67198.phpt
new file mode 100644
index 0000000000..9e2e224509
--- /dev/null
+++ b/tests/basic/bug67198.phpt
@@ -0,0 +1,42 @@
+--TEST--
+php://input is empty when enable_post_data_reading=Off
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php
+include __DIR__."/../../sapi/cli/tests/skipif.inc";
+?>
+--FILE--
+<?php
+require __DIR__."/../../sapi/cli/tests/php_cli_server.inc";
+
+$code =
+<<<'FL'
+ if(!ini_get('enable_post_data_reading')){
+ if($_SERVER['REQUEST_METHOD']=='POST'){
+ exit(file_get_contents('php://input'));
+ }
+ }else{
+ exit('Please SET php.ini: enable_post_data_reading = Off');
+ }
+FL;
+
+$postdata = "PASS";
+
+$opts = array('http' =>
+ array(
+ 'method' => 'POST',
+ 'header' => 'Content-type: application/x-www-form-urlencoded',
+ 'content' => $postdata
+ )
+);
+
+$context = stream_context_create($opts);
+
+php_cli_server_start("exit(file_get_contents('php://input'));", false, "-d enable_post_data_reading=Off");
+
+var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context));
+var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context));
+--EXPECT--
+string(4) "PASS"
+string(4) "PASS"