]> granicus.if.org Git - php/commitdiff
Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline options)
authorDmitry Stogov <dmitry@php.net>
Fri, 31 Aug 2007 12:17:52 +0000 (12:17 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 31 Aug 2007 12:17:52 +0000 (12:17 +0000)
NEWS
sapi/cgi/cgi_main.c

diff --git a/NEWS b/NEWS
index 27bf9e96f7a1c3856598380287a4447fc5e82342..6063736a741e8a173997c696ba5ca877dc5d7149 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
 
 - Fixed bug #42462 (Segmentation when trying to set an attribute in a 
   DOMElement). (Rob)
+- Fixed bug #42453 (CGI SAPI does not shut down cleanly with -i/-m/-v cmdline
+  options). (Dmitry)
 - Fixed bug #42452 (PDO classes do not expose Reflection API information).
   (Hannes)
 - Fixed bug #42359 (xsd:list type not parsed). (Dmitry)
index ad0ab8d9acb511df271c7260a1ed6b9a941a757b..a6ce49271afe44f90306d976a71ac63c68de11ed 100644 (file)
@@ -1471,8 +1471,8 @@ consult the installation file that came with this distribution, or visit \n\
                                        SG(headers_sent) = 1;
                                        php_cgi_usage(argv[0]);
                                        php_end_ob_buffers(1 TSRMLS_CC);
-                                       exit(1);
-                                       break;
+                                       exit_status = 0;
+                                       goto out;
                        }
                }
                php_optind = orig_optind;
@@ -1511,7 +1511,8 @@ consult the installation file that came with this distribution, or visit \n\
                                SG(headers_sent) = 1;
                                php_printf("You cannot use both -n and -c switch. Use -h for help.\n");
                                php_end_ob_buffers(1 TSRMLS_CC);
-                               exit(1);
+                               exit_status = 1;
+                               goto out;
                        }
 
                        while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0)) != -1) {
@@ -1552,9 +1553,9 @@ consult the installation file that came with this distribution, or visit \n\
                                                        SG(request_info).no_headers = 1;
                                                }
                                                php_print_info(0xFFFFFFFF TSRMLS_CC);
-                                               php_end_ob_buffers(1 TSRMLS_CC);
-                                               exit(0);
-                                               break;
+                                               php_request_shutdown((void *) 0);
+                                               exit_status = 0;
+                                               goto out;
 
                                case 'l': /* syntax check mode */
                                                no_headers = 1;
@@ -1571,8 +1572,8 @@ consult the installation file that came with this distribution, or visit \n\
                                        print_extensions(TSRMLS_C);
                                        php_printf("\n");
                                        php_end_ob_buffers(1 TSRMLS_CC);
-                                       exit(0);
-                                       break;
+                                       exit_status = 0;
+                                       goto out;
 
 #if 0 /* not yet operational, see also below ... */
                                case '': /* generate indented source mode*/
@@ -1600,9 +1601,9 @@ consult the installation file that came with this distribution, or visit \n\
 #else
                                                php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2007 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
 #endif
-                                               php_end_ob_buffers(1 TSRMLS_CC);
-                                               exit(0);
-                                               break;
+                                               php_request_shutdown((void *) 0);
+                                               exit_status = 0;
+                                               goto out;
 
                                case 'w':
                                                behavior = PHP_MODE_STRIP;
@@ -1890,6 +1891,7 @@ fastcgi_request_done:
                exit_status = 255;
        } zend_end_try();
 
+out:
        SG(server_context) = NULL;
        php_module_shutdown(TSRMLS_C);
        sapi_shutdown();