File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ PHP NEWS
41
41
. Fixed bug #68175 (RegexIterator pregFlags are NULL instead of 0). (Tim
42
42
Siebels)
43
43
44
+ - Standard:
45
+ . Fixed bug #76778 (array_reduce leaks memory if callback throws exception).
46
+ (cmb)
47
+
44
48
- zlib:
45
49
. Fixed bug #65988 (Zlib version check fails when an include/zlib/ style dir
46
50
is passed to the --with-zlib configure option). (Jay Bonci)
Original file line number Diff line number Diff line change @@ -5243,6 +5243,7 @@ PHP_FUNCTION(array_reduce)
5243
5243
} else {
5244
5244
zval_ptr_dtor (& args [1 ]);
5245
5245
zval_ptr_dtor (& args [0 ]);
5246
+ zval_ptr_dtor (& result );
5246
5247
return ;
5247
5248
}
5248
5249
} ZEND_HASH_FOREACH_END ();
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #76778 (array_reduce leaks memory if callback throws exception)
3
+ --SKIPIF--
4
+ <?php
5
+ if (getenv ("SKIP_SLOW_TESTS " )) die ('skip slow test ' );
6
+ ?>
7
+ --INI--
8
+ memory_limit=32M
9
+ --FILE--
10
+ <?php
11
+ for ($ i = 0 ; $ i < 100 ; $ i ++) {
12
+ try {
13
+ array_reduce (
14
+ [1 ],
15
+ function ($ carry , $ item ) {
16
+ throw new Exception ;
17
+ },
18
+ range (1 , 200000 )
19
+ );
20
+ } catch (Exception $ e ) {
21
+ }
22
+ }
23
+ ?>
24
+ ===DONE===
25
+ --EXPECT--
26
+ ===DONE===
You can’t perform that action at this time.
0 commit comments