From a2a30ca7d306b14036746753b10c283ce43cbf96 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Fri, 22 Aug 2003 20:02:11 +0000 Subject: [PATCH] MFH: Fixed bug #25127 (reset memory_limit before terminating the request) --- main/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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; -- 2.50.1