felipe Sat, 25 Jun 2011 14:17:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312459
Log:
- Fixed crash when calling sapi_shutdown() and sapi hasn't been started
Reported by: David Tajchreber
Changed paths:
U php/php-src/branches/PHP_5_4/sapi/cli/php_cli.c
U php/php-src/trunk/sapi/cli/php_cli.c
Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/php_cli.c 2011-06-25 13:15:24 UTC
(rev 312458)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli.c 2011-06-25 14:17:17 UTC
(rev 312459)
@@ -1194,7 +1194,7 @@
#endif
int c;
int exit_status = SUCCESS;
- int module_started = 0;
+ int module_started = 0, sapi_started = 0;
char *php_optarg = NULL;
int php_optind = 1;
char *ini_path_override = NULL;
@@ -1312,6 +1312,7 @@
sapi_module->phpinfo_as_text = 1;
sapi_module->php_ini_ignore_cwd = 1;
sapi_startup(sapi_module);
+ sapi_started = 1;
sapi_module->php_ini_ignore = ini_ignore;
@@ -1364,7 +1365,9 @@
if (module_started) {
php_module_shutdown(TSRMLS_C);
}
- sapi_shutdown();
+ if (sapi_started) {
+ sapi_shutdown();
+ }
#ifdef ZTS
tsrm_shutdown();
#endif
Modified: php/php-src/trunk/sapi/cli/php_cli.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_cli.c 2011-06-25 13:15:24 UTC (rev
312458)
+++ php/php-src/trunk/sapi/cli/php_cli.c 2011-06-25 14:17:17 UTC (rev
312459)
@@ -1194,7 +1194,7 @@
#endif
int c;
int exit_status = SUCCESS;
- int module_started = 0;
+ int module_started = 0, sapi_started = 0;
char *php_optarg = NULL;
int php_optind = 1;
char *ini_path_override = NULL;
@@ -1312,6 +1312,7 @@
sapi_module->phpinfo_as_text = 1;
sapi_module->php_ini_ignore_cwd = 1;
sapi_startup(sapi_module);
+ sapi_started = 1;
sapi_module->php_ini_ignore = ini_ignore;
@@ -1364,7 +1365,9 @@
if (module_started) {
php_module_shutdown(TSRMLS_C);
}
- sapi_shutdown();
+ if (sapi_started) {
+ sapi_shutdown();
+ }
#ifdef ZTS
tsrm_shutdown();
#endif
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php