]> granicus.if.org Git - php/commitdiff
Fixed bug #38543 (shutdown_executor() may segfault when memory_limit is too low).
authorDmitry Stogov <dmitry@php.net>
Tue, 22 Aug 2006 12:04:53 +0000 (12:04 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 22 Aug 2006 12:04:53 +0000 (12:04 +0000)
NEWS
sapi/cli/php_cli.c

diff --git a/NEWS b/NEWS
index 2fceb35ee92a41b8efabfdc01036ac7f32b40dde..1bcdf8f2d6a7bc30c5d59fe16290c6c6d801376e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Sep 2006, PHP 5.2.0
+- Fixed bug #38543 (shutdown_executor() may segfault when memory_limit is too
+  low). (Dmitry)
 - Fixed bug #38535 (memory corruption in pdo_pgsql driver on error retrieval
   inside a failed query executed via query() method). (Ilia)
 - Fixed bug #38524 (strptime() does not initialize the internal date storage
index a7e3288be21c39fa7003380b465d44daaa75169b..63e0314b16f8f4ca81a91d3a7c9b65d58e1791d6 100644 (file)
@@ -585,6 +585,7 @@ int main(int argc, char *argv[])
        char *script_file=NULL;
        int interactive=0;
        int module_started = 0;
+       int request_started = 0;
        int lineno = 0;
        char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL;
        const char *param_error=NULL;
@@ -711,6 +712,7 @@ int main(int argc, char *argv[])
                                if (php_request_startup(TSRMLS_C)==FAILURE) {
                                        goto err;
                                }
+                               request_started = 1;
                                php_cli_usage(argv[0]);
                                php_end_ob_buffers(1 TSRMLS_CC);
                                exit_status=0;
@@ -720,6 +722,7 @@ int main(int argc, char *argv[])
                                if (php_request_startup(TSRMLS_C)==FAILURE) {
                                        goto err;
                                }
+                               request_started = 1;
                                php_print_info(0xFFFFFFFF TSRMLS_CC);
                                php_end_ob_buffers(1 TSRMLS_CC);
                                exit_status=0;
@@ -729,6 +732,7 @@ int main(int argc, char *argv[])
                                if (php_request_startup(TSRMLS_C)==FAILURE) {
                                        goto err;
                                }
+                               request_started = 1;
                                php_printf("[PHP Modules]\n");
                                print_modules(TSRMLS_C);
                                php_printf("\n[Zend Modules]\n");
@@ -743,6 +747,7 @@ int main(int argc, char *argv[])
                                        goto err;
                                }
 
+                               request_started = 1;
                                php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2006 The PHP Group\n%s",
                                        PHP_VERSION, sapi_module.name, __DATE__, __TIME__,
 #if ZEND_DEBUG && defined(HAVE_GCOV)
@@ -993,10 +998,10 @@ int main(int argc, char *argv[])
                if (php_request_startup(TSRMLS_C)==FAILURE) {
                        *arg_excp = arg_free;
                        fclose(file_handle.handle.fp);
-                       php_request_shutdown((void *) 0);
                        PUTS("Could not startup.\n");
                        goto err;
                }
+               request_started = 1;
                CG(start_lineno) = lineno;
                *arg_excp = arg_free; /* reconstuct argv */
 
@@ -1247,7 +1252,9 @@ int main(int argc, char *argv[])
        } zend_end_try();
 
 out:
-       php_request_shutdown((void *) 0);
+       if (request_started) {
+               php_request_shutdown((void *) 0);
+       }
        if (exit_status == 0) {
                exit_status = EG(exit_status);
        }