Commit eb4bde8
authored
Split the illegal string offsets example output by PHP version (#5232)
The output shown for the example was already corrected in master; what the
issue thread still asked for was making the version difference visible.
Split the output into two sections with example.outputs.8 and
example.outputs.7, and state the PHP 8 rule in the introductory paragraph.
State the PHP 8 rule as it actually is. A string starting with an integer
followed by other characters, such as "1x", does not throw a TypeError: it
still emits E_WARNING and is read as its leading integer, which the PHP 8
output of this very example shows. Only the other non-integer-like strings
throw.
The PHP 7 output is what PHP 7 really prints: isset() rejects every offset
that is not integer-like, so it is false for both '1.0' and '1x', and '1x'
emits "A non well formed numeric value encountered" rather than an illegal
offset warning, since the read path allows trailing data.
Sources:
- Zend/zend_execute.c, zend_isset_dim_slow() and the string branch of
zend_fetch_dimension_address_read(); Zend/zend_operators.c,
_is_numeric_string_ex()
- Zend/tests/offset_string.phpt and Zend/tests/isset_str_offset.phpt in 7.4
- PHP 8 output verified against PHP 8.5.41 parent 5a91c9a commit eb4bde8
1 file changed
Lines changed: 33 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1088 | 1088 | | |
1089 | 1089 | | |
1090 | 1090 | | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1095 | 1100 | | |
1096 | 1101 | | |
1097 | 1102 | | |
| |||
1116 | 1121 | | |
1117 | 1122 | | |
1118 | 1123 | | |
1119 | | - | |
| 1124 | + | |
1120 | 1125 | | |
1121 | 1126 | | |
1122 | 1127 | | |
| |||
1130 | 1135 | | |
1131 | 1136 | | |
1132 | 1137 | | |
1133 | | - | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1134 | 1161 | | |
1135 | 1162 | | |
1136 | 1163 | | |
| |||
0 commit comments