File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? ????, PHP 7.4.19
4
4
5
+ - Core:
6
+ . Fixed bug #80929 (Method name corruption related to repeated calls to call_user_func_array).
7
+ (twosee)
8
+
5
9
- SPL:
6
10
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
7
11
(cmb, Nikita)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #80929: Method name corruption related to zend_closure_call_magic
3
+ --FILE--
4
+ <?php
5
+ class DefaultListener
6
+ {
7
+ public function handleDefaultEvent ($ event ) { }
8
+ }
9
+
10
+ class SubscriberProxy
11
+ {
12
+ private array $ subscribedEvents ;
13
+ private object $ subscriber ;
14
+ private Closure $ listener ;
15
+
16
+ public function __construct (array $ subscribedEvents , object $ subscriber )
17
+ {
18
+ $ this ->subscribedEvents = $ subscribedEvents ;
19
+ $ this ->subscriber = $ subscriber ;
20
+ foreach ($ this ->subscribedEvents as $ eventName => $ params ) {
21
+ $ this ->listener = Closure::fromCallable ([$ this , $ params ]);
22
+ }
23
+ }
24
+
25
+ public function __call (string $ name , array $ arguments )
26
+ {
27
+ return $ this ->subscriber ->$ name (...$ arguments );
28
+ }
29
+
30
+ public function dispatch ($ event , string $ eventName )
31
+ {
32
+ ($ this ->listener )($ event , $ eventName , null );
33
+ }
34
+ }
35
+
36
+ $ proxy = new SubscriberProxy (
37
+ ['defaultEvent ' => 'handleDefaultEvent ' ],
38
+ new DefaultListener ()
39
+ );
40
+
41
+ for ($ i = 0 ; $ i < 10 ; $ i ++) {
42
+ echo $ i . PHP_EOL ;
43
+ $ proxy ->dispatch (null , 'defaultEvent ' );
44
+ }
45
+ ?>
46
+ --EXPECT--
47
+ 0
48
+ 1
49
+ 2
50
+ 3
51
+ 4
52
+ 5
53
+ 6
54
+ 7
55
+ 8
56
+ 9
Original file line number Diff line number Diff line change @@ -270,7 +270,6 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
270
270
271
271
zend_call_function (& fci , & fcc );
272
272
273
- zval_ptr_dtor (& fci .params [0 ]);
274
273
zval_ptr_dtor (& fci .params [1 ]);
275
274
}
276
275
/* }}} */
@@ -473,6 +472,8 @@ static void zend_closure_free_storage(zend_object *object) /* {{{ */
473
472
474
473
if (closure -> func .type == ZEND_USER_FUNCTION ) {
475
474
destroy_op_array (& closure -> func .op_array );
475
+ } else if (closure -> orig_internal_handler == zend_closure_call_magic ) {
476
+ zend_string_release (closure -> func .common .function_name );
476
477
}
477
478
478
479
if (Z_TYPE (closure -> this_ptr ) != IS_UNDEF ) {
You can’t perform that action at this time.
0 commit comments