From 2209c1a599ed5588bdf01d55ce788e0e6d969b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 22 Jul 2023 14:41:04 +0200 Subject: [PATCH 1/6] Fix the attempted allocation size in OOM error messages The sizes reported in the error messages previously didn't match the sizes that were actually checked against the memory limit. This can result in confusing error reports, because the reported size often tends to be much smaller than the actual chunk allocation size used in accounting. Consider the following example script: overflow == 0) { #if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, ZEND_MM_CHUNK_SIZE); #else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, ZEND_MM_PAGE_SIZE * pages_count); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, ZEND_MM_CHUNK_SIZE); #endif return NULL; } @@ -1028,9 +1028,9 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_F #if !ZEND_MM_LIMIT zend_mm_safe_error(heap, "Out of memory"); #elif ZEND_DEBUG - zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, ZEND_MM_CHUNK_SIZE); #else - zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) (tried to allocate %zu bytes)", heap->real_size, ZEND_MM_PAGE_SIZE * pages_count); + zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) (tried to allocate %zu bytes)", heap->real_size, ZEND_MM_CHUNK_SIZE); #endif return NULL; } @@ -1536,9 +1536,9 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt /* pass */ } else if (heap->overflow == 0) { #if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, (new_size - old_size)); #else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, (new_size - old_size)); #endif return NULL; } @@ -1828,9 +1828,9 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D /* pass */ } else if (heap->overflow == 0) { #if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, new_size); #else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, size); + zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, new_size); #endif return NULL; } @@ -1846,9 +1846,9 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D #if !ZEND_MM_LIMIT zend_mm_safe_error(heap, "Out of memory"); #elif ZEND_DEBUG - zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, size); + zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) at %s:%d (tried to allocate %zu bytes)", heap->real_size, __zend_filename, __zend_lineno, new_size); #else - zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) (tried to allocate %zu bytes)", heap->real_size, size); + zend_mm_safe_error(heap, "Out of memory (allocated %zu bytes) (tried to allocate %zu bytes)", heap->real_size, new_size); #endif return NULL; } From 88cbee2fa0284afabb76abd2f1e5b8cf26fbaf74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 25 Jul 2023 11:26:40 +0200 Subject: [PATCH 2/6] Add additional information of the memory_limit exceeded error messages --- Zend/zend_alloc.c | 104 ++++++++++++++++++++++++++++------------------ 1 file changed, 64 insertions(+), 40 deletions(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 6c5e4b55d7d99..f2fa9d83937fe 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -368,26 +368,17 @@ static ZEND_COLD ZEND_NORETURN void zend_mm_panic(const char *message) abort(); } -static ZEND_COLD ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, - const char *format, - size_t limit, -#if ZEND_DEBUG - const char *filename, - uint32_t lineno, -#endif - size_t size) +static ZEND_COLD ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, char* format, ...) { + va_list args; heap->overflow = 1; zend_try { - zend_error_noreturn(E_ERROR, - format, - limit, -#if ZEND_DEBUG - filename, - lineno, -#endif - size); + va_start(args, format); + zend_string *message = zend_vstrpprintf(0, format, args); + zend_error_noreturn(E_ERROR, "%s", ZSTR_VAL(message)); + zend_string_release(message); + va_end(args); } zend_catch { } zend_end_try(); heap->overflow = 0; @@ -1009,11 +1000,21 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_F if (zend_mm_gc(heap)) { goto get_chunk; } else if (heap->overflow == 0) { -#if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, ZEND_MM_CHUNK_SIZE); -#else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, ZEND_MM_CHUNK_SIZE); -#endif + zend_mm_safe_error( + heap, + "Allowed memory size of %zu bytes exhausted by %zu bytes" +# if ZEND_DEBUG + " at %s:%d" +# endif + ". Allocated %zu bytes and need to allocate %zu bytes to satisfy a request for %zu bytes", + + heap->limit, (ZEND_MM_CHUNK_SIZE - (heap->limit - heap->real_size)), +# if ZEND_DEBUG + __zend_filename, __zend_lineno, +# endif + heap->real_size, ZEND_MM_CHUNK_SIZE, (ZEND_DEBUG ? size : ZEND_MM_PAGE_SIZE * pages_count) + ); + return NULL; } } @@ -1535,11 +1536,20 @@ static zend_never_inline void *zend_mm_realloc_huge(zend_mm_heap *heap, void *pt if (zend_mm_gc(heap) && new_size - old_size <= heap->limit - heap->real_size) { /* pass */ } else if (heap->overflow == 0) { -#if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, (new_size - old_size)); -#else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, (new_size - old_size)); -#endif + zend_mm_safe_error( + heap, + "Allowed memory size of %zu bytes exhausted by %zu bytes" +# if ZEND_DEBUG + " at %s:%d" +# endif + ". Allocated %zu bytes and need to allocate %zu bytes to satisfy a reallocation from %zu to %zu bytes", + + heap->limit, ((new_size - old_size) - (heap->limit - heap->real_size)), +# if ZEND_DEBUG + __zend_filename, __zend_lineno, +# endif + heap->real_size, (new_size - old_size), old_size, new_size + ); return NULL; } } @@ -1827,11 +1837,20 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D if (zend_mm_gc(heap) && new_size <= heap->limit - heap->real_size) { /* pass */ } else if (heap->overflow == 0) { -#if ZEND_DEBUG - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", heap->limit, __zend_filename, __zend_lineno, new_size); -#else - zend_mm_safe_error(heap, "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", heap->limit, new_size); -#endif + zend_mm_safe_error( + heap, + "Allowed memory size of %zu bytes exhausted by %zu bytes" +# if ZEND_DEBUG + " at %s:%d" +# endif + ". Allocated %zu bytes and need to allocate %zu bytes", + + heap->limit, (new_size - (heap->limit - heap->real_size)), +# if ZEND_DEBUG + __zend_filename, __zend_lineno, +# endif + heap->real_size, new_size + ); return NULL; } } @@ -2823,15 +2842,20 @@ static zend_always_inline zval *tracked_get_size_zv(zend_mm_heap *heap, void *pt static zend_always_inline void tracked_check_limit(zend_mm_heap *heap, size_t add_size) { if (add_size > heap->limit - heap->size && !heap->overflow) { -#if ZEND_DEBUG - zend_mm_safe_error(heap, - "Allowed memory size of %zu bytes exhausted at %s:%d (tried to allocate %zu bytes)", - heap->limit, "file", 0, add_size); -#else - zend_mm_safe_error(heap, - "Allowed memory size of %zu bytes exhausted (tried to allocate %zu bytes)", - heap->limit, add_size); -#endif + zend_mm_safe_error( + heap, + "Allowed memory size of %zu bytes exhausted by %zu bytes" +# if ZEND_DEBUG + " at %s:%d" +# endif + ". Allocated %zu bytes and need to allocate %zu bytes", + + heap->limit, (add_size - (heap->limit - heap->real_size)), +# if ZEND_DEBUG + "file", 0, +# endif + heap->real_size, add_size + ); } } From 26d13298562c3a8bf93e1861dd00cdbc658cbc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 25 Jul 2023 11:37:26 +0200 Subject: [PATCH 3/6] fixup! Add additional information of the memory_limit exceeded error messages --- Zend/zend_alloc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f2fa9d83937fe..82b413200e355 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -1012,7 +1012,12 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_F # if ZEND_DEBUG __zend_filename, __zend_lineno, # endif - heap->real_size, ZEND_MM_CHUNK_SIZE, (ZEND_DEBUG ? size : ZEND_MM_PAGE_SIZE * pages_count) + heap->real_size, ZEND_MM_CHUNK_SIZE, +# if ZEND_DEBUG + size +# else + ZEND_MM_PAGE_SIZE * pages_count +# endif ); return NULL; From 3d73ae4633a5090561b94dcb9bb266b830c6d9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Oct 2023 18:59:26 +0200 Subject: [PATCH 4/6] Fix tests --- Zend/tests/bug40770.phpt | 2 +- Zend/tests/bug54268.phpt | 2 +- Zend/tests/bug55509.phpt | 2 +- Zend/tests/bug70258.phpt | 2 +- Zend/tests/bug76846.phpt | 2 +- Zend/tests/bug79836_4.phpt | 2 +- Zend/tests/fibers/get-return-after-bailout.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-fiber.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt | 2 +- Zend/tests/gh11189.phpt | 2 +- Zend/tests/gh11189_1.phpt | 2 +- Zend/tests/gh12073.phpt | 2 +- Zend/tests/new_oom.phpt | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Zend/tests/bug40770.phpt b/Zend/tests/bug40770.phpt index f37d96d5ff333..927cfc8a9ee8d 100644 --- a/Zend/tests/bug40770.phpt +++ b/Zend/tests/bug40770.phpt @@ -19,4 +19,4 @@ for ($i=0; $i<=$mb; $i++) { } ?> --EXPECTF-- -Fatal error: Allowed memory size of 8388608 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d diff --git a/Zend/tests/bug54268.phpt b/Zend/tests/bug54268.phpt index 3567aaa6ee570..6cdfca54964a5 100644 --- a/Zend/tests/bug54268.phpt +++ b/Zend/tests/bug54268.phpt @@ -34,4 +34,4 @@ $x = new Test(); Test::$mystatic = new DestructorCreator(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index 1ae5b04f8a0df..dba61b3bfa7ca 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -78,4 +78,4 @@ echo "5\n"; 3 4 -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/bug70258.phpt b/Zend/tests/bug70258.phpt index 40915a286ef9e..e1eecbcdd37c5 100644 --- a/Zend/tests/bug70258.phpt +++ b/Zend/tests/bug70258.phpt @@ -25,4 +25,4 @@ $a = new A; $a->core(); ?> --EXPECTF-- -Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/bug76846.phpt b/Zend/tests/bug76846.phpt index cd837bd860973..51e0be6c8def2 100644 --- a/Zend/tests/bug76846.phpt +++ b/Zend/tests/bug76846.phpt @@ -23,4 +23,4 @@ while (true) { ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d%A +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d diff --git a/Zend/tests/bug79836_4.phpt b/Zend/tests/bug79836_4.phpt index 2d6b862f42139..dbb06e75c6617 100644 --- a/Zend/tests/bug79836_4.phpt +++ b/Zend/tests/bug79836_4.phpt @@ -15,4 +15,4 @@ $e = new Foo(); $e .= $i; ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/fibers/get-return-after-bailout.phpt b/Zend/tests/fibers/get-return-after-bailout.phpt index 04bd464cfab0e..987a536d8f010 100644 --- a/Zend/tests/fibers/get-return-after-bailout.phpt +++ b/Zend/tests/fibers/get-return-after-bailout.phpt @@ -22,7 +22,7 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) %sget-return-after-bailout.php on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d Fatal error: Uncaught FiberError: Cannot get fiber return value: The fiber exited with a fatal error in %sget-return-after-bailout.php:%d Stack trace: diff --git a/Zend/tests/fibers/out-of-memory-in-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-fiber.phpt index 4d31aa6f76adc..97cd8722350d2 100644 --- a/Zend/tests/fibers/out-of-memory-in-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-fiber.phpt @@ -22,4 +22,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sout-of-memory-in-fiber.php on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt index 9e82b893faddb..75e7a3016df38 100644 --- a/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt @@ -26,4 +26,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sout-of-memory-in-nested-fiber.php on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt index bf711629229bd..6ff6e147e00bf 100644 --- a/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt @@ -23,4 +23,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sout-of-memory-in-recursive-fiber.php on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/gh11189.phpt b/Zend/tests/gh11189.phpt index f1c877f20ee47..f4e47df9cac47 100644 --- a/Zend/tests/gh11189.phpt +++ b/Zend/tests/gh11189.phpt @@ -26,4 +26,4 @@ while (1) { ?> --EXPECTF-- Success -Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/gh11189_1.phpt b/Zend/tests/gh11189_1.phpt index 53727908e5e2a..5dd02134a53a0 100644 --- a/Zend/tests/gh11189_1.phpt +++ b/Zend/tests/gh11189_1.phpt @@ -26,4 +26,4 @@ while (1) { ?> --EXPECTF-- Success -Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/gh12073.phpt b/Zend/tests/gh12073.phpt index ef115685ce7d4..3f3f7cf6686c5 100644 --- a/Zend/tests/gh12073.phpt +++ b/Zend/tests/gh12073.phpt @@ -25,4 +25,4 @@ for ($i = 0; $i < 10_000; $i++) { ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/new_oom.phpt b/Zend/tests/new_oom.phpt index 93d1bdf7b691a..5fe8b3d3c8de2 100644 --- a/Zend/tests/new_oom.phpt +++ b/Zend/tests/new_oom.phpt @@ -12,7 +12,7 @@ $php = PHP_BINARY; foreach (get_declared_classes() as $class) { $output = shell_exec("$php --no-php-ini $file $class 2>&1"); - if ($output && preg_match('(^\nFatal error: Allowed memory size of [0-9]+ bytes exhausted[^\r\n]* \(tried to allocate [0-9]+ bytes\) in [^\r\n]+ on line [0-9]+$)', $output) !== 1) { + if ($output && preg_match('(^\nFatal error: Allowed memory size of [0-9]+ bytes exhausted by [0-9]+ bytes[^\r\n]*. Allocated [0-9]+ bytes and need to allocate [0-9]+ bytes to satisfy a request for [0-9]+ bytes in [^\r\n]+ on line [0-9]+$)', $output) !== 1) { echo "Class $class failed\n"; echo $output, "\n"; } From a58bf1be2d2a8fa6f5e236e8a1bf8214db185f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Oct 2023 19:27:03 +0200 Subject: [PATCH 5/6] Fix tests --- ext/standard/tests/streams/bug61115-1.phpt | 2 +- ext/standard/tests/strings/chunk_split_variation3.phpt | 2 +- ext/standard/tests/strings/str_pad_variation1.phpt | 2 +- ext/standard/tests/strings/wordwrap_memory_limit.phpt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/standard/tests/streams/bug61115-1.phpt b/ext/standard/tests/streams/bug61115-1.phpt index 892b0f80e5792..5d9c3fd593d85 100644 --- a/ext/standard/tests/streams/bug61115-1.phpt +++ b/ext/standard/tests/streams/bug61115-1.phpt @@ -14,4 +14,4 @@ stream_context_get_options($fileResourceTemp); ftruncate($fileResourceTemp, PHP_INT_MAX); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt index 56c524ef02d57..0158ae8ff47ab 100644 --- a/ext/standard/tests/strings/chunk_split_variation3.phpt +++ b/ext/standard/tests/strings/chunk_split_variation3.phpt @@ -21,4 +21,4 @@ var_dump(chunk_split($body, $chunk_length)); Body generation Using chunk_split() -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt index cb71e61156fcd..80fe5d5da5402 100644 --- a/ext/standard/tests/strings/str_pad_variation1.phpt +++ b/ext/standard/tests/strings/str_pad_variation1.phpt @@ -33,4 +33,4 @@ var_dump( str_pad($input, $php_int_max_pad_length) ); *** Testing str_pad() function: with large value for for 'pad_length' argument *** str_pad(): Argument #2 ($length) must be of type int, float given -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/wordwrap_memory_limit.phpt b/ext/standard/tests/strings/wordwrap_memory_limit.phpt index 21340153faea1..30e4b81120ba9 100644 --- a/ext/standard/tests/strings/wordwrap_memory_limit.phpt +++ b/ext/standard/tests/strings/wordwrap_memory_limit.phpt @@ -16,4 +16,4 @@ wordwrap($str, 1, $str2); ?> --EXPECTF-- -Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d From 3d4c9ca9813ef93a08a62dc062261a0d6a980981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Oct 2023 20:01:31 +0200 Subject: [PATCH 6/6] Fix tests --- Zend/tests/bug40770.phpt | 2 +- Zend/tests/bug54268.phpt | 2 +- Zend/tests/bug55509.phpt | 2 +- Zend/tests/bug70258.phpt | 2 +- Zend/tests/bug76846.phpt | 2 +- Zend/tests/bug79836_4.phpt | 2 +- Zend/tests/fibers/get-return-after-bailout.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-fiber.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt | 2 +- Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt | 2 +- Zend/tests/gh11189.phpt | 2 +- Zend/tests/gh11189_1.phpt | 2 +- Zend/tests/gh12073.phpt | 2 +- ext/oci8/tests/pecl_bug10194.phpt | 2 +- ext/oci8/tests/pecl_bug10194_blob.phpt | 2 +- ext/oci8/tests/pecl_bug10194_blob_64.phpt | 2 +- ext/standard/tests/streams/bug61115-1.phpt | 2 +- ext/standard/tests/strings/chunk_split_variation3.phpt | 2 +- ext/standard/tests/strings/str_pad_variation1.phpt | 2 +- ext/standard/tests/strings/wordwrap_memory_limit.phpt | 2 +- ext/zend_test/tests/observer_error_01.phpt | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Zend/tests/bug40770.phpt b/Zend/tests/bug40770.phpt index 927cfc8a9ee8d..c5f7d658c59f1 100644 --- a/Zend/tests/bug40770.phpt +++ b/Zend/tests/bug40770.phpt @@ -19,4 +19,4 @@ for ($i=0; $i<=$mb; $i++) { } ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d diff --git a/Zend/tests/bug54268.phpt b/Zend/tests/bug54268.phpt index 6cdfca54964a5..a5986940844bc 100644 --- a/Zend/tests/bug54268.phpt +++ b/Zend/tests/bug54268.phpt @@ -34,4 +34,4 @@ $x = new Test(); Test::$mystatic = new DestructorCreator(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index dba61b3bfa7ca..cef6fbf09e2a3 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -78,4 +78,4 @@ echo "5\n"; 3 4 -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/bug70258.phpt b/Zend/tests/bug70258.phpt index e1eecbcdd37c5..17048a164c143 100644 --- a/Zend/tests/bug70258.phpt +++ b/Zend/tests/bug70258.phpt @@ -25,4 +25,4 @@ $a = new A; $a->core(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/bug76846.phpt b/Zend/tests/bug76846.phpt index 51e0be6c8def2..b19f9b9d25528 100644 --- a/Zend/tests/bug76846.phpt +++ b/Zend/tests/bug76846.phpt @@ -23,4 +23,4 @@ while (true) { ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a reallocation from %d to %d bytes in %s on line %d diff --git a/Zend/tests/bug79836_4.phpt b/Zend/tests/bug79836_4.phpt index dbb06e75c6617..33f4fe14edd53 100644 --- a/Zend/tests/bug79836_4.phpt +++ b/Zend/tests/bug79836_4.phpt @@ -15,4 +15,4 @@ $e = new Foo(); $e .= $i; ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/fibers/get-return-after-bailout.phpt b/Zend/tests/fibers/get-return-after-bailout.phpt index 987a536d8f010..6105d65be8411 100644 --- a/Zend/tests/fibers/get-return-after-bailout.phpt +++ b/Zend/tests/fibers/get-return-after-bailout.phpt @@ -22,7 +22,7 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d Fatal error: Uncaught FiberError: Cannot get fiber return value: The fiber exited with a fatal error in %sget-return-after-bailout.php:%d Stack trace: diff --git a/Zend/tests/fibers/out-of-memory-in-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-fiber.phpt index 97cd8722350d2..5263e916beca2 100644 --- a/Zend/tests/fibers/out-of-memory-in-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-fiber.phpt @@ -22,4 +22,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt index 75e7a3016df38..f8516e3592d51 100644 --- a/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt @@ -26,4 +26,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt b/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt index 6ff6e147e00bf..34d30c80a2780 100644 --- a/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt +++ b/Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt @@ -23,4 +23,4 @@ $fiber->start(); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/gh11189.phpt b/Zend/tests/gh11189.phpt index f4e47df9cac47..c25f317d3fd34 100644 --- a/Zend/tests/gh11189.phpt +++ b/Zend/tests/gh11189.phpt @@ -26,4 +26,4 @@ while (1) { ?> --EXPECTF-- Success -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/Zend/tests/gh11189_1.phpt b/Zend/tests/gh11189_1.phpt index 5dd02134a53a0..8c9a78f61c56d 100644 --- a/Zend/tests/gh11189_1.phpt +++ b/Zend/tests/gh11189_1.phpt @@ -26,4 +26,4 @@ while (1) { ?> --EXPECTF-- Success -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/Zend/tests/gh12073.phpt b/Zend/tests/gh12073.phpt index 3f3f7cf6686c5..c4ed3d438d512 100644 --- a/Zend/tests/gh12073.phpt +++ b/Zend/tests/gh12073.phpt @@ -25,4 +25,4 @@ for ($i = 0; $i < 10_000; $i++) { ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes to satisfy a request for %d bytes in %s on line %d diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt index 5abe77da8d9f2..fe776022d996d 100644 --- a/ext/oci8/tests/pecl_bug10194.phpt +++ b/ext/oci8/tests/pecl_bug10194.phpt @@ -54,4 +54,4 @@ require __DIR__.'/drop_table.inc'; echo "Done\n"; ?> --EXPECTF-- -Fatal error: Allowed memory size of 10485760 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt index a6a08764f6aae..0d1e1a73b4c20 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -58,4 +58,4 @@ echo "Done\n"; --EXPECTF-- Before load() -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt index 8893570e20dc8..db5611f8ddb9d 100644 --- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -59,4 +59,4 @@ echo "Done\n"; --EXPECTF-- Before load() -Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/streams/bug61115-1.phpt b/ext/standard/tests/streams/bug61115-1.phpt index 5d9c3fd593d85..2f5f300b88117 100644 --- a/ext/standard/tests/streams/bug61115-1.phpt +++ b/ext/standard/tests/streams/bug61115-1.phpt @@ -14,4 +14,4 @@ stream_context_get_options($fileResourceTemp); ftruncate($fileResourceTemp, PHP_INT_MAX); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt index 0158ae8ff47ab..c9e52affb8509 100644 --- a/ext/standard/tests/strings/chunk_split_variation3.phpt +++ b/ext/standard/tests/strings/chunk_split_variation3.phpt @@ -21,4 +21,4 @@ var_dump(chunk_split($body, $chunk_length)); Body generation Using chunk_split() -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt index 80fe5d5da5402..4a86e40cd6136 100644 --- a/ext/standard/tests/strings/str_pad_variation1.phpt +++ b/ext/standard/tests/strings/str_pad_variation1.phpt @@ -33,4 +33,4 @@ var_dump( str_pad($input, $php_int_max_pad_length) ); *** Testing str_pad() function: with large value for for 'pad_length' argument *** str_pad(): Argument #2 ($length) must be of type int, float given -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/standard/tests/strings/wordwrap_memory_limit.phpt b/ext/standard/tests/strings/wordwrap_memory_limit.phpt index 30e4b81120ba9..dbd02d1daa573 100644 --- a/ext/standard/tests/strings/wordwrap_memory_limit.phpt +++ b/ext/standard/tests/strings/wordwrap_memory_limit.phpt @@ -16,4 +16,4 @@ wordwrap($str, 1, $str2); ?> --EXPECTF-- -Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%s. Allocated %d bytes and need to allocate %d bytes in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d diff --git a/ext/zend_test/tests/observer_error_01.phpt b/ext/zend_test/tests/observer_error_01.phpt index 971080089c10d..c937dc6ec25e6 100644 --- a/ext/zend_test/tests/observer_error_01.phpt +++ b/ext/zend_test/tests/observer_error_01.phpt @@ -30,7 +30,7 @@ echo 'You should not see this.'; -Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d +Fatal error: Allowed memory size of %d bytes exhausted by %d bytes%S. Allocated %d bytes and need to allocate %d bytes in %s on line %d