File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ function gen() {
22
22
}
23
23
var_dump ([...gen ()]);
24
24
25
+ // Same as previous, but with refcounted string.
26
+ function gen2 () {
27
+ $ foo = "2 " ;
28
+ yield "4 " . $ foo => 42 ;
29
+ }
30
+ var_dump ([...gen2 ()]);
31
+
25
32
?>
26
33
--EXPECT--
27
34
array(4) {
@@ -56,3 +63,7 @@ array(1) {
56
63
[0]=>
57
64
int(42)
58
65
}
66
+ array(1) {
67
+ [0]=>
68
+ int(42)
69
+ }
Original file line number Diff line number Diff line change @@ -6060,6 +6060,7 @@ ZEND_VM_C_LABEL(add_unpack_again):
6060
6060
zend_hash_update (result_ht , Z_STR (key ), val );
6061
6061
zval_ptr_dtor_str (& key );
6062
6062
} else {
6063
+ zval_ptr_dtor (& key );
6063
6064
if (!zend_hash_next_index_insert (result_ht , val )) {
6064
6065
zend_cannot_add_element ();
6065
6066
zval_ptr_dtor_nogc (val );
Original file line number Diff line number Diff line change @@ -2609,6 +2609,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER(
2609
2609
zend_hash_update(result_ht, Z_STR(key), val);
2610
2610
zval_ptr_dtor_str(&key);
2611
2611
} else {
2612
+ zval_ptr_dtor(&key);
2612
2613
if (!zend_hash_next_index_insert(result_ht, val)) {
2613
2614
zend_cannot_add_element();
2614
2615
zval_ptr_dtor_nogc(val);
You can’t perform that action at this time.
0 commit comments