Download | Plain Text | No Line Numbers


  1. diff -Naur a/build/gen_stub.php b/build/gen_stub.php
  2. --- a/build/gen_stub.php 2026-10-19 19:02:46.000000000 +0200
  3. +++ b/build/gen_stub.php 2026-10-21 15:48:33.790102242 +0200
  4. @@ -3051,6 +3051,7 @@
  5. "username" => "ZEND_STR_USERNAME",
  6. "password" => "ZEND_STR_PASSWORD",
  7. "clone" => "ZEND_STR_CLONE",
  8. + "memory_limit" => "ZEND_STR_MEMORY_LIMIT",
  9. '8.0' => 'ZEND_STR_8_DOT_0',
  10. '8.1' => 'ZEND_STR_8_DOT_1',
  11. '8.2' => 'ZEND_STR_8_DOT_2',
  12. diff -Naur a/main/main.c b/main/main.c
  13. --- a/main/main.c 2026-10-21 15:46:21.154304938 +0200
  14. +++ b/main/main.c 2026-10-21 15:51:43.307014361 +0200
  15. @@ -378,12 +378,18 @@
  16. }
  17.  
  18. if (zend_set_memory_limit(value) == FAILURE) {
  19. - zend_error(E_ERROR, "Failed to set memory limit to %zd bytes (Current memory usage is %zd bytes)", value, zend_memory_usage(true));
  20. - return FAILURE;
  21. + if (stage != ZEND_INI_STAGE_DEACTIVATE) {
  22. + zend_error(E_ERROR, "Failed to set memory limit to %zd bytes (Current memory usage is %zd bytes)", value, zend_memory_usage(true));
  23. + return FAILURE;
  24. + }
  25. }
  26.  
  27. - PG(memory_limit) = value;
  28. PG(max_memory_limit) = value;
  29. + if (stage == ZEND_INI_STAGE_DEACTIVATE) {
  30. + PG(memory_limit) = value;
  31. + } else {
  32. + zend_alter_ini_entry(ZSTR_KNOWN(ZEND_STR_MEMORY_LIMIT), new_value, PHP_INI_ALL, stage);
  33. + }
  34.  
  35. return SUCCESS;
  36. }
  37. diff -Naur a/Zend/zend_string.h b/Zend/zend_string.h
  38. --- a/Zend/zend_string.h 2026-10-19 19:02:46.000000000 +0200
  39. +++ b/Zend/zend_string.h 2026-10-21 15:48:33.791404255 +0200
  40. @@ -716,6 +716,7 @@
  41. _(ZEND_STR_SINCE, "since") \
  42. _(ZEND_STR_GET, "get") \
  43. _(ZEND_STR_SET, "set") \
  44. + _(ZEND_STR_MEMORY_LIMIT, "memory_limit") \
  45. _(ZEND_STR_8_DOT_0, "8.0") \
  46. _(ZEND_STR_8_DOT_1, "8.1") \
  47. _(ZEND_STR_8_DOT_2, "8.2") \
  48.