Skip to content

Commit 9b98cf3

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Revert "Went to fast and forgot to update tests" Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails"
2 parents 13c9572 + a0df5f3 commit 9b98cf3

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ PHP_FUNCTION(mb_detect_order)
20422042

20432043
static inline int php_mb_check_code_point(zend_long cp)
20442044
{
2045-
if (cp < 0 || cp >= 0x110000) {
2045+
if (cp <= 0 || cp >= 0x110000) {
20462046
/* Out of Unicode range */
20472047
return 0;
20482048
}

ext/mbstring/tests/bug79448.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

ext/mbstring/tests/mb_substitute_character.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ string(4) "82a0"
3838
bool(true)
3939
string(6) "entity"
4040
string(20) "262378323636303b82a0"
41-
bool(true)
41+
ERR: Warning
42+
bool(false)

ext/mbstring/tests/mb_substitute_character_basic.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var_dump( mb_substitute_character("b") );
2828

2929
?>
3030
===DONE===
31-
--EXPECT--
31+
--EXPECTF--
3232
*** Testing mb_substitute_character() : basic functionality ***
3333
int(63)
3434
bool(true)
@@ -37,5 +37,7 @@ bool(true)
3737
int(1234)
3838
bool(true)
3939
string(4) "none"
40-
bool(true)
40+
41+
Warning: mb_substitute_character(): Unknown character in %s on line %d
42+
bool(false)
4143
===DONE===

ext/mbstring/tests/mb_substitute_character_variation1.phpt

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ fclose($fp);
123123
*** Testing mb_substitute_character() : usage variation ***
124124

125125
--int 0--
126-
bool(true)
126+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
127+
bool(false)
127128

128129
--int 1--
129130
bool(true)
@@ -151,10 +152,12 @@ Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
151152
bool(false)
152153

153154
--float .5--
154-
bool(true)
155+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
156+
bool(false)
155157

156158
--empty array--
157-
bool(true)
159+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
160+
bool(false)
158161

159162
--int indexed array--
160163
bool(true)
@@ -166,22 +169,26 @@ bool(true)
166169
bool(true)
167170

168171
--uppercase NULL--
169-
bool(true)
172+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
173+
bool(false)
170174

171175
--lowercase null--
172-
bool(true)
176+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
177+
bool(false)
173178

174179
--lowercase true--
175180
bool(true)
176181

177182
--lowercase false--
178-
bool(true)
183+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
184+
bool(false)
179185

180186
--uppercase TRUE--
181187
bool(true)
182188

183189
--uppercase FALSE--
184-
bool(true)
190+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
191+
bool(false)
185192

186193
--empty string DQ--
187194
bool(true)
@@ -190,16 +197,20 @@ bool(true)
190197
bool(true)
191198

192199
--string DQ--
193-
bool(true)
200+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
201+
bool(false)
194202

195203
--string SQ--
196-
bool(true)
204+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
205+
bool(false)
197206

198207
--mixed case string--
199-
bool(true)
208+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
209+
bool(false)
200210

201211
--heredoc--
202-
bool(true)
212+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
213+
bool(false)
203214

204215
--instance of classWithToString--
205216
Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
@@ -210,8 +221,10 @@ Error: 8 - Object of class classWithoutToString could not be converted to int, %
210221
bool(true)
211222

212223
--undefined var--
213-
bool(true)
224+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
225+
bool(false)
214226

215227
--unset var--
216-
bool(true)
228+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
229+
bool(false)
217230
===DONE===

0 commit comments

Comments
 (0)