]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #25127 (reset memory_limit before terminating the request)
authorIlia Alshanetsky <iliaa@php.net>
Fri, 22 Aug 2003 20:02:11 +0000 (20:02 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 22 Aug 2003 20:02:11 +0000 (20:02 +0000)
main/main.c

index 9a0aaa174d7bb1d4b9b495af6970e6a1344c1b02..aebcd01acf1092052086c9201117f667f3c0a1de 100644 (file)
@@ -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;