]> granicus.if.org Git - php/commitdiff
Fixed bug #61728 (php-fpm SIGSEGV running friendica on nginx)
authorXinchen Hui <laruence@php.net>
Sat, 14 Apr 2012 17:16:34 +0000 (01:16 +0800)
committerXinchen Hui <laruence@php.net>
Sat, 14 Apr 2012 17:16:34 +0000 (01:16 +0800)
NEWS
ext/session/tests/bug61728.phpt [new file with mode: 0644]
main/main.c

diff --git a/NEWS b/NEWS
index 05cc254c65de70678ce2076d7a0ebe39a3f414ea..2b65382b232e96b4c5a9a62694926a273f27eb1e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP                                                                        NEWS
 (merge after 5.3.11 release)
 
 - Core:
+  . Fixed bug #61728 (php-fpm SIGSEGV running friendica on nginx). (Laruence)
   . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov)
   . Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables
     (without apache2)). (Laruence)
diff --git a/ext/session/tests/bug61728.phpt b/ext/session/tests/bug61728.phpt
new file mode 100644 (file)
index 0000000..30b876e
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+Bug #61728 (php-fpm SIGSEGV running friendica on nginx)
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--FILE--
+<?php 
+function output_html($ext) {
+    return strlen($ext);
+}
+
+function open ($save_path, $session_name) { 
+    return true;
+} 
+
+function close() { 
+    return true;
+} 
+
+function read ($id) { 
+} 
+
+function write ($id, $sess_data) { 
+    ob_start("output_html");
+    echo "laruence";
+    ob_end_flush();
+    return true;
+} 
+
+function destroy ($id) { 
+} 
+
+function gc ($maxlifetime) { 
+    return true; 
+} 
+
+session_set_save_handler ("open", "close", "read", "write", "destroy", "gc"); 
+session_start();
+--EXPECTF--
+8
index 6a04ddbaf100ce8e4a56b3927f74cf0d87c05ffe..c34f952433a619e64bb8c1db933ed4fb5d43f584 100644 (file)
@@ -1740,22 +1740,22 @@ void php_request_shutdown(void *dummy)
                }
        } zend_end_try();
 
-       /* 4. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */
-       zend_try {
-               php_output_deactivate(TSRMLS_C);
-       } zend_end_try();
-
-       /* 5. Reset max_execution_time (no longer executing php code after response sent) */
+       /* 4. Reset max_execution_time (no longer executing php code after response sent) */
        zend_try {
                zend_unset_timeout(TSRMLS_C);
        } zend_end_try();
 
-       /* 6. Call all extensions RSHUTDOWN functions */
+       /* 5. Call all extensions RSHUTDOWN functions */
        if (PG(modules_activated)) {
                zend_deactivate_modules(TSRMLS_C);
                php_free_shutdown_functions(TSRMLS_C);
        }
 
+       /* 6. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */
+       zend_try {
+               php_output_deactivate(TSRMLS_C);
+       } zend_end_try();
+
        /* 7. Destroy super-globals */
        zend_try {
                int i;