File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -2103,7 +2103,6 @@ static uint32_t assign_dim_result_type(
2103
2103
tmp |= MAY_BE_RC1 | MAY_BE_RCN ;
2104
2104
}
2105
2105
if (tmp & MAY_BE_ARRAY ) {
2106
- tmp |= (value_type & MAY_BE_ANY ) << MAY_BE_ARRAY_SHIFT ;
2107
2106
if (value_type & MAY_BE_UNDEF ) {
2108
2107
tmp |= MAY_BE_ARRAY_OF_NULL ;
2109
2108
}
@@ -2124,6 +2123,11 @@ static uint32_t assign_dim_result_type(
2124
2123
tmp |= MAY_BE_ARRAY_KEY_STRING ;
2125
2124
}
2126
2125
}
2126
+ /* Only add value type if we have a key type. It might be that the key type is illegal
2127
+ * for arrays. */
2128
+ if (tmp & MAY_BE_ARRAY_KEY_ANY ) {
2129
+ tmp |= (value_type & MAY_BE_ANY ) << MAY_BE_ARRAY_SHIFT ;
2130
+ }
2127
2131
}
2128
2132
return tmp ;
2129
2133
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Don't add array value type is key type is illegal
3
+ --FILE--
4
+ <?php
5
+
6
+ function test (\SplObjectStorage $ definitions = null ) {
7
+ $ argument = new stdClass ;
8
+ $ definitions [$ argument ] = 1 ;
9
+ $ definitions [$ argument ] += 1 ;
10
+ $ argument = [];
11
+ $ definitions [$ argument ] = 1 ;
12
+ $ definitions [$ argument ] += 1 ;
13
+ }
14
+
15
+ ?>
16
+ ===DONE===
17
+ --EXPECT--
18
+ ===DONE===
You can’t perform that action at this time.
0 commit comments