diff options
author | Anatol Belski <ab@php.net> | 2014-07-21 11:35:22 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-07-21 11:35:22 +0200 |
commit | 457f1a3ad57cad31d410ef0e08e25c7ab0f4e9a8 (patch) | |
tree | ca2dd3f62d04af8097b45630b0801b35144f6b98 | |
parent | 6ac9e106af2f7c84142cc22a0a910686420546a7 (diff) | |
parent | 833e4669832137edbc4526a0d7c10f16396554a0 (diff) | |
download | php-git-457f1a3ad57cad31d410ef0e08e25c7ab0f4e9a8.tar.gz |
Merge remote-tracking branch 'origin/master' into str_size_and_int64
* origin/master:
This test depends on expose_php being on
fixed broken merged code
Fixed a bug that cannot access custom request header stored in apache_request_headers() though array index.
Test output relies on expose_php being on
1.2 is a problematic float to print out Lower the default display precision for this test
The test output is dependent on expose_php ini
cleanup file headers.
Do not kill children process in pre-fork mode when parent process quit.
update year & copyright
Fix bug #67587: Redirection loop on nginx with FPM
Fix still broken session test. Only return true/false.
Followup fix to custom session save handlers
Fix handling of session user module custom handlers.
Update info.c
Conflicts:
ext/session/mod_user.c
main/php_content_types.c
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/session/mod_user.c | 25 | ||||
-rw-r--r-- | ext/session/session.c | 2 | ||||
-rw-r--r-- | ext/session/tests/bug60634_error_1.phpt | 1 | ||||
-rw-r--r-- | ext/session/tests/bug60634_error_2.phpt | 1 | ||||
-rw-r--r-- | ext/session/tests/save_handler.inc | 5 | ||||
-rw-r--r-- | ext/session/tests/session_module_name_variation3.phpt | 14 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_class_002.phpt | 3 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_class_005.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_class_012.phpt | 6 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_class_016.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_class_017.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_error3.phpt | 4 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_error4.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_iface_001.phpt | 2 | ||||
-rw-r--r-- | ext/session/tests/session_set_save_handler_variation4.phpt | 1 | ||||
-rw-r--r-- | main/php_content_types.c | 23 |
17 files changed, 51 insertions, 45 deletions
@@ -12,6 +12,7 @@ PHP NEWS - Standard: . Removed call_user_method() and call_user_method_array() functions. (Kalle) + . Fix user session handlers (See rfc:session.user.return-value). (Sara) - XSL: . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike) diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index f984a2d6ca..73d0c45364 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -68,12 +68,25 @@ static zval *ps_call_handler(zval *func, int argc, zval **argv TSRMLS_DC) #define PSF(a) PS(mod_user_names).name.ps_##a -#define FINISH \ - if (retval) { \ - convert_to_int(retval); \ - ret = Z_IVAL_P(retval); \ - zval_ptr_dtor(&retval); \ - } \ +#define FINISH \ + if (retval) { \ + if (Z_TYPE_P(retval) == IS_BOOL) { \ + ret = Z_BVAL_P(retval) ? SUCCESS : FAILURE; \ + } else if ((Z_TYPE_P(retval) == IS_INT) && (Z_IVAL_P(retval) == -1)) { \ + /* BC for clever users - Deprecate me */ \ + ret = FAILURE; \ + } else if ((Z_TYPE_P(retval) == IS_INT) && (Z_IVAL_P(retval) == 0)) { \ + /* BC for clever users - Deprecate me */ \ + ret = SUCCESS; \ + } else { \ + if (!EG(exception)) { \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, \ + "Session callback expects true/false return value"); \ + } \ + ret = FAILURE; \ + } \ + zval_ptr_dtor(&retval); \ + } \ return ret PS_OPEN_FUNC(user) diff --git a/ext/session/session.c b/ext/session/session.c index a61a357a0f..d659b14ef1 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -566,7 +566,7 @@ static void php_session_save_current_state(TSRMLS_D) /* {{{ */ } } - if (ret == FAILURE) { + if ((ret == FAILURE) && !EG(exception)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write session data (%s). Please " "verify that the current setting of session.save_path " "is correct (%s)", diff --git a/ext/session/tests/bug60634_error_1.phpt b/ext/session/tests/bug60634_error_1.phpt index e41592f18d..cc50e81209 100644 --- a/ext/session/tests/bug60634_error_1.phpt +++ b/ext/session/tests/bug60634_error_1.phpt @@ -16,6 +16,7 @@ function open($save_path, $session_name) { function close() { echo "close: goodbye cruel world\n"; + return true; } function read($id) { diff --git a/ext/session/tests/bug60634_error_2.phpt b/ext/session/tests/bug60634_error_2.phpt index 7c50948ba8..96c8eb61e5 100644 --- a/ext/session/tests/bug60634_error_2.phpt +++ b/ext/session/tests/bug60634_error_2.phpt @@ -16,6 +16,7 @@ function open($save_path, $session_name) { function close() { echo "close: goodbye cruel world\n"; + return true; } function read($id) { diff --git a/ext/session/tests/save_handler.inc b/ext/session/tests/save_handler.inc index ebe9cac564..d271748259 100644 --- a/ext/session/tests/save_handler.inc +++ b/ext/session/tests/save_handler.inc @@ -31,7 +31,7 @@ function write($id, $session_data) { if ($fp = fopen($session_file, "w")) { $return = fwrite($fp, $session_data); fclose($fp); - return $return; + return (bool)$return; } return false; } @@ -40,7 +40,8 @@ function destroy($id) { global $session_save_path, $name; echo "Destroy [${session_save_path},${id}]\n"; $session_file = "$session_save_path/".SESSION_FILE_PREFIX.$id; - return unlink($session_file); + unlink($session_file); + return true; } function gc($maxlifetime) { diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt index dc1c6ba5ec..e32790d54e 100644 --- a/ext/session/tests/session_module_name_variation3.phpt +++ b/ext/session/tests/session_module_name_variation3.phpt @@ -21,11 +21,11 @@ function open($save_path, $session_name) { throw new Exception("Stop...!"); } -function close() { } -function read($id) { } -function write($id, $session_data) { } -function destroy($id) { } -function gc($maxlifetime) { } +function close() { return true; } +function read($id) { return ''; } +function write($id, $session_data) { return true; } +function destroy($id) { return true; } +function gc($maxlifetime) { return true; } var_dump(session_module_name("files")); session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); @@ -41,9 +41,11 @@ ob_end_flush(); string(%d) "%s" string(4) "user" -Fatal error: Uncaught exception 'Exception' with message 'Stop...!' in %s:%d +Warning: Uncaught exception 'Exception' with message 'Stop...!' in %s:%d Stack trace: #0 [internal function]: open('', 'PHPSESSID') #1 %s(%d): session_start() #2 {main} thrown in %s on line %d + +Fatal error: session_start(): Failed to initialize storage module: %s in %s/session_module_name_variation3.php on line %d diff --git a/ext/session/tests/session_set_save_handler_class_002.phpt b/ext/session/tests/session_set_save_handler_class_002.phpt index 6fb831f695..b75a7e6390 100644 --- a/ext/session/tests/session_set_save_handler_class_002.phpt +++ b/ext/session/tests/session_set_save_handler_class_002.phpt @@ -38,11 +38,12 @@ class MySession2 extends SessionHandler { } public function write($id, $data) { - return file_put_contents($this->path . $id, $data); + return (bool)file_put_contents($this->path . $id, $data); } public function destroy($id) { @unlink($this->path . $id); + return true; } public function gc($maxlifetime) { 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 c74c81de1d..5be735306a 100644 --- a/ext/session/tests/session_set_save_handler_class_005.phpt +++ b/ext/session/tests/session_set_save_handler_class_005.phpt @@ -52,4 +52,6 @@ array(0) { Warning: SessionHandler::write(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d +Warning: session_write_close(): Failed to write session data %s in %ssession_set_save_handler_class_005.php on line %d + Warning: SessionHandler::close(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d 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 3899d28816..60cd12955c 100644 --- a/ext/session/tests/session_set_save_handler_class_012.phpt +++ b/ext/session/tests/session_set_save_handler_class_012.phpt @@ -24,7 +24,9 @@ class MySession extends SessionHandler { public function open($path, $name) { ++$this->i; echo 'Open ', session_id(), "\n"; - return parent::open(); + // This test was written for broken return value handling + // Mimmick what was actually being tested by returning true here + return (null === parent::open()); } public function read($key) { ++$this->i; @@ -57,4 +59,6 @@ array(0) { Warning: Unknown: Parent session handler is not open in Unknown on line 0 +Warning: Unknown: Failed to write session data %s in %s on line %d + Warning: Unknown: Parent session handler is not open in Unknown on line 0 diff --git a/ext/session/tests/session_set_save_handler_class_016.phpt b/ext/session/tests/session_set_save_handler_class_016.phpt index 2de03c0682..521bd86f31 100644 --- a/ext/session/tests/session_set_save_handler_class_016.phpt +++ b/ext/session/tests/session_set_save_handler_class_016.phpt @@ -38,7 +38,7 @@ class MySession2 extends SessionHandler { } public function write($id, $data) { - return file_put_contents($this->path . $id, $data); + return (bool)file_put_contents($this->path . $id, $data); } public function destroy($id) { diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt index 756dc55d03..6f42d7809a 100644 --- a/ext/session/tests/session_set_save_handler_class_017.phpt +++ b/ext/session/tests/session_set_save_handler_class_017.phpt @@ -38,7 +38,7 @@ class MySession2 extends SessionHandler { } public function write($id, $data) { - return file_put_contents($this->path . $id, $data); + return (bool)file_put_contents($this->path . $id, $data); } public function destroy($id) { diff --git a/ext/session/tests/session_set_save_handler_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt index cb07b0d8de..859ba11ad5 100644 --- a/ext/session/tests/session_set_save_handler_error3.phpt +++ b/ext/session/tests/session_set_save_handler_error3.phpt @@ -34,9 +34,11 @@ ob_end_flush(); --EXPECTF-- *** Testing session_set_save_handler() : error functionality *** -Fatal error: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d +Warning: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d Stack trace: #0 [internal function]: open('', 'PHPSESSID') #1 %s(%d): session_start() #2 {main} thrown in %s on line %d + +Fatal error: session_start(): Failed to initialize storage module: %s in %ssession_set_save_handler_error3.php on line %d diff --git a/ext/session/tests/session_set_save_handler_error4.phpt b/ext/session/tests/session_set_save_handler_error4.phpt index d286f07d99..be3429b084 100644 --- a/ext/session/tests/session_set_save_handler_error4.phpt +++ b/ext/session/tests/session_set_save_handler_error4.phpt @@ -15,7 +15,7 @@ ob_start(); echo "*** Testing session_set_save_handler() : error functionality ***\n"; -function callback() { } +function callback() { return true; } session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback"); session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback"); diff --git a/ext/session/tests/session_set_save_handler_iface_001.phpt b/ext/session/tests/session_set_save_handler_iface_001.phpt index 39a4b9975b..03ee42865c 100644 --- a/ext/session/tests/session_set_save_handler_iface_001.phpt +++ b/ext/session/tests/session_set_save_handler_iface_001.phpt @@ -38,7 +38,7 @@ class MySession2 implements SessionHandlerInterface { } public function write($id, $data) { - return file_put_contents($this->path . $id, $data); + return (bool)file_put_contents($this->path . $id, $data); } public function destroy($id) { diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt index 3485f2373a..c34eb9cd9f 100644 --- a/ext/session/tests/session_set_save_handler_variation4.phpt +++ b/ext/session/tests/session_set_save_handler_variation4.phpt @@ -24,6 +24,7 @@ echo "*** Testing session_set_save_handler() : variation ***\n"; function noisy_gc($maxlifetime) { echo("GC [".$maxlifetime."]\n"); gc($maxlifetime); + return true; } require_once "save_handler.inc"; diff --git a/main/php_content_types.c b/main/php_content_types.c index 26e939e7b3..c8db921421 100644 --- a/main/php_content_types.c +++ b/main/php_content_types.c @@ -42,29 +42,6 @@ SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader) /* no post handler registered, so we just swallow the data */ sapi_read_standard_form_data(TSRMLS_C); } - - if (populate_raw_post_data(TSRMLS_C)) { - size_t length; - char *data = NULL; - - php_stream_rewind(SG(request_info).request_body); - length = php_stream_copy_to_mem(SG(request_info).request_body, &data, PHP_STREAM_COPY_ALL, 0); - php_stream_rewind(SG(request_info).request_body); - - if (length > INT_MAX) { - sapi_module.sapi_error(E_WARNING, - "HTTP_RAW_POST_DATA truncated from %lu to %d bytes", - (unsigned long) length, INT_MAX); - length = INT_MAX; - } - SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length); - - sapi_module.sapi_error(E_DEPRECATED, - "Automatically populating $HTTP_RAW_POST_DATA is deprecated and " - "will be removed in a future version. To avoid this warning set " - "'always_populate_raw_post_data' to '-1' in php.ini and use the " - "php://input stream instead."); - } } } /* }}} */ |