From: Ilia Alshanetsky Date: Fri, 22 Aug 2003 20:02:11 +0000 (+0000) Subject: MFH: Fixed bug #25127 (reset memory_limit before terminating the request) X-Git-Tag: php-4.3.3~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2a30ca7d306b14036746753b10c283ce43cbf96;p=php MFH: Fixed bug #25127 (reset memory_limit before terminating the request) --- diff --git a/main/main.c b/main/main.c index 9a0aaa174d..aebcd01acf 100644 --- a/main/main.c +++ b/main/main.c @@ -150,14 +150,12 @@ static PHP_INI_MH(OnSetPrecision) */ static PHP_INI_MH(OnChangeMemoryLimit) { - int new_limit; - if (new_value) { - new_limit = zend_atoi(new_value, new_value_length); + PG(memory_limit) = zend_atoi(new_value, new_value_length); } else { - new_limit = 1<<30; /* effectively, no limit */ + PG(memory_limit) = 1<<30; /* effectively, no limit */ } - return zend_set_memory_limit(new_limit); + return zend_set_memory_limit(PG(memory_limit)); } /* }}} */ #endif @@ -702,6 +700,10 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ case E_USER_ERROR: EG(exit_status) = 255; if (module_initialized) { +#if MEMORY_LIMIT + /* restore memory limit */ + AG(memory_limit) = PG(memory_limit); +#endif zend_bailout(); efree(buffer); return;