diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 13:48:32 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 13:49:35 +0200 |
commit | cdd9eb8c4af41c17f37d605054508c2ed9fe8004 (patch) | |
tree | 283d41eaffb4c53d49c0a5ca8e60c8bc431d2579 /ext/standard/tests | |
parent | 2527a0fcfd949d811f7c015aa676e47a342751b8 (diff) | |
parent | 70b2fca220fc27a16cc9f81f6c6da0f2a6d6d610 (diff) | |
download | php-git-cdd9eb8c4af41c17f37d605054508c2ed9fe8004.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix #76778: array_reduce leaks memory if callback throws exception
Diffstat (limited to 'ext/standard/tests')
-rw-r--r-- | ext/standard/tests/array/bug76778.phpt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/standard/tests/array/bug76778.phpt b/ext/standard/tests/array/bug76778.phpt new file mode 100644 index 0000000000..2c65497d12 --- /dev/null +++ b/ext/standard/tests/array/bug76778.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #76778 (array_reduce leaks memory if callback throws exception) +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die('skip slow test'); +?> +--INI-- +memory_limit=32M +--FILE-- +<?php +for ($i = 0; $i < 100; $i++) { + try { + array_reduce( + [1], + function ($carry, $item) { + throw new Exception; + }, + range(1, 200000) + ); + } catch (Exception $e) { + } +} +?> +===DONE=== +--EXPECT-- +===DONE=== |