diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 13:50:46 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-08-22 13:51:16 +0200 |
commit | 1de17428f671b6a5ca0495655a597a58b79517a5 (patch) | |
tree | daf2fa0caf59d7de4bd21ef926b1cdca0e0aaf83 /ext/standard/tests | |
parent | dd07f17f9788e14d2a7db795fd7152ad3164a3f2 (diff) | |
parent | cdd9eb8c4af41c17f37d605054508c2ed9fe8004 (diff) | |
download | php-git-1de17428f671b6a5ca0495655a597a58b79517a5.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
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=== |