File tree Expand file tree Collapse file tree 7 files changed +94
-5
lines changed Expand file tree Collapse file tree 7 files changed +94
-5
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ PHP NEWS
99
99
- Standard:
100
100
. E_NOTICEs emitted by unserialize() have been promoted to E_WARNING. (timwolla)
101
101
. Make array_pad's $length warning less confusing. (nielsdos)
102
+ . E_WARNING emitted by strtok in the caase both arguments are not provided when
103
+ starting tokenisation. (David Carlier)
102
104
103
105
- Streams:
104
106
. Fixed bug #51056: blocking fread() will block even if data is available.
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ PHP 8.3 UPGRADE NOTES
68
68
. array_pad() is now only limited by the maximum number of elements an array
69
69
can have. Before, it was only possible to add at most 1048576 elements at a
70
70
time.
71
+ . strtok() raises a warninin the case token is not provided when starting tokenization.
71
72
72
73
========================================
73
74
6. New Functions
Original file line number Diff line number Diff line change @@ -1080,7 +1080,7 @@ PHP_FUNCTION(strtok)
1080
1080
1081
1081
if (!BG (strtok_string )) {
1082
1082
/* String to tokenize not set. */
1083
- // TODO: Should this warn?
1083
+ php_error_docref ( NULL , E_WARNING , "Both arguments must be provided when starting tokenization" );
1084
1084
RETURN_FALSE ;
1085
1085
}
1086
1086
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ foreach($heredoc_strings as $string) {
62
62
63
63
echo "Done \n" ;
64
64
?>
65
- --EXPECT --
65
+ --EXPECTF --
66
66
*** Testing strtok() : with heredoc strings ***
67
67
68
68
--- Iteration 1 ---
@@ -80,15 +80,35 @@ bool(false)
80
80
81
81
--- Iteration 2 ---
82
82
bool(false)
83
+
84
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
83
85
bool(false)
86
+
87
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
84
88
bool(false)
89
+
90
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
85
91
bool(false)
92
+
93
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
86
94
bool(false)
95
+
96
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
87
97
bool(false)
98
+
99
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
88
100
bool(false)
101
+
102
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
89
103
bool(false)
104
+
105
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
90
106
bool(false)
107
+
108
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
91
109
bool(false)
110
+
111
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
92
112
bool(false)
93
113
94
114
--- Iteration 3 ---
@@ -137,9 +157,19 @@ string(3) "rld"
137
157
string(4) "hell"
138
158
string(4) "hell"
139
159
bool(false)
160
+
161
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
140
162
bool(false)
163
+
164
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
141
165
bool(false)
166
+
167
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
142
168
bool(false)
169
+
170
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
143
171
bool(false)
172
+
173
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
144
174
bool(false)
145
175
Done
Original file line number Diff line number Diff line change @@ -36,15 +36,25 @@ foreach( $strings_with_nulls as $string ) {
36
36
37
37
echo "Done \n" ;
38
38
?>
39
- --EXPECT --
39
+ --EXPECTF --
40
40
*** Testing strtok() : with embedded nulls in the strings ***
41
41
42
42
--- Iteration 1 ---
43
43
bool(false)
44
+
45
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
44
46
bool(false)
47
+
48
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
45
49
bool(false)
50
+
51
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
46
52
bool(false)
53
+
54
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
47
55
bool(false)
56
+
57
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
48
58
bool(false)
49
59
50
60
--- Iteration 2 ---
@@ -82,9 +92,17 @@ bool(false)
82
92
--- Iteration 6 ---
83
93
string(11) "hello world"
84
94
bool(false)
95
+
96
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
85
97
bool(false)
98
+
99
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
86
100
bool(false)
101
+
102
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
87
103
bool(false)
104
+
105
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
88
106
bool(false)
89
107
90
108
--- Iteration 7 ---
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ foreach( $string_array as $string ) {
52
52
53
53
echo "Done \n" ;
54
54
?>
55
- --EXPECT --
55
+ --EXPECTF --
56
56
*** Testing strtok() : with miscellaneous inputs ***
57
57
58
58
--- Iteration 1 ---
@@ -65,10 +65,20 @@ bool(false)
65
65
66
66
--- Iteration 2 ---
67
67
bool(false)
68
+
69
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
68
70
bool(false)
71
+
72
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
69
73
bool(false)
74
+
75
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
70
76
bool(false)
77
+
78
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
71
79
bool(false)
80
+
81
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
72
82
bool(false)
73
83
74
84
--- Iteration 3 ---
@@ -113,18 +123,38 @@ bool(false)
113
123
114
124
--- Iteration 8 ---
115
125
bool(false)
126
+
127
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
116
128
bool(false)
129
+
130
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
117
131
bool(false)
132
+
133
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
118
134
bool(false)
135
+
136
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
119
137
bool(false)
138
+
139
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
120
140
bool(false)
121
141
122
142
--- Iteration 9 ---
123
143
bool(false)
144
+
145
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
124
146
bool(false)
147
+
148
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
125
149
bool(false)
150
+
151
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
126
152
bool(false)
153
+
154
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
127
155
bool(false)
156
+
157
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
128
158
bool(false)
129
159
130
160
--- Iteration 10 ---
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ foreach( $string_array as $string ) {
42
42
43
43
echo "Done \n" ;
44
44
?>
45
- --EXPECT --
45
+ --EXPECTF --
46
46
*** Testing strtok() : with invalid escape sequences in token ***
47
47
48
48
--- Iteration 1 ---
@@ -69,6 +69,8 @@ bool(false)
69
69
string(1) " "
70
70
string(1) "r"
71
71
bool(false)
72
+
73
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
72
74
bool(false)
73
75
74
76
@@ -91,11 +93,15 @@ bool(false)
91
93
string(5) "hello"
92
94
string(6) " world"
93
95
bool(false)
96
+
97
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
94
98
bool(false)
95
99
96
100
string(1) " "
97
101
string(1) "r"
98
102
bool(false)
103
+
104
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
99
105
bool(false)
100
106
101
107
@@ -113,6 +119,8 @@ bool(false)
113
119
string(6) "hello\"
114
120
string(6) " world"
115
121
bool(false)
122
+
123
+ Warning: strtok(): Both arguments must be provided when starting tokenization in %s on line %d
116
124
bool(false)
117
125
118
126
string(1) "/"
You can’t perform that action at this time.
0 commit comments