Skip to content

Commit 1e8459d

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: 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 4e69970 + 9b98cf3 commit 1e8459d

File tree

5 files changed

+35
-29
lines changed

5 files changed

+35
-29
lines changed

ext/mbstring/mbstring.c

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

15341534
static inline int php_mb_check_code_point(zend_long cp)
15351535
{
1536-
if (cp < 0 || cp >= 0x110000) {
1536+
if (cp <= 0 || cp >= 0x110000) {
15371537
/* Out of Unicode range */
15381538
return 0;
15391539
}

ext/mbstring/tests/bug79448.phpt

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

ext/mbstring/tests/mb_substitute_character.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var_dump(bin2hex(mb_convert_encoding("\xe2\x99\xa0\xe3\x81\x82", "CP932", "UTF-8
2525

2626
var_dump(mb_substitute_character('BAD_NAME'));
2727
?>
28-
--EXPECT--
28+
--EXPECTF--
2929
bool(true)
3030
int(12356)
3131
string(8) "82a282a0"
@@ -38,4 +38,6 @@ string(4) "82a0"
3838
bool(true)
3939
string(6) "entity"
4040
string(20) "262378323636303b82a0"
41-
bool(true)
41+
42+
Warning: mb_substitute_character(): Unknown character in %s on line %d
43+
bool(false)

ext/mbstring/tests/mb_substitute_character_basic.phpt

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

2929
?>
30-
--EXPECT--
30+
--EXPECTF--
3131
*** Testing mb_substitute_character() : basic functionality ***
3232
int(63)
3333
bool(true)
@@ -36,4 +36,6 @@ bool(true)
3636
int(1234)
3737
bool(true)
3838
string(4) "none"
39-
bool(true)
39+
40+
Warning: mb_substitute_character(): Unknown character in %s on line %d
41+
bool(false)

ext/mbstring/tests/mb_substitute_character_variation1.phpt

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

124124
--int 0--
125-
bool(true)
125+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
126+
bool(false)
126127

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

152153
--float .5--
153-
bool(true)
154+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
155+
bool(false)
154156

155157
--empty array--
156-
bool(true)
158+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
159+
bool(false)
157160

158161
--int indexed array--
159162
bool(true)
@@ -165,22 +168,26 @@ bool(true)
165168
bool(true)
166169

167170
--uppercase NULL--
168-
bool(true)
171+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
172+
bool(false)
169173

170174
--lowercase null--
171-
bool(true)
175+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
176+
bool(false)
172177

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

176181
--lowercase false--
177-
bool(true)
182+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
183+
bool(false)
178184

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

182188
--uppercase FALSE--
183-
bool(true)
189+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
190+
bool(false)
184191

185192
--empty string DQ--
186193
bool(true)
@@ -189,16 +196,20 @@ bool(true)
189196
bool(true)
190197

191198
--string DQ--
192-
bool(true)
199+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
200+
bool(false)
193201

194202
--string SQ--
195-
bool(true)
203+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
204+
bool(false)
196205

197206
--mixed case string--
198-
bool(true)
207+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
208+
bool(false)
199209

200210
--heredoc--
201-
bool(true)
211+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
212+
bool(false)
202213

203214
--instance of classWithToString--
204215
Error: 8 - Object of class classWithToString could not be converted to int, %s(%d)
@@ -209,7 +220,9 @@ Error: 8 - Object of class classWithoutToString could not be converted to int, %
209220
bool(true)
210221

211222
--undefined var--
212-
bool(true)
223+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
224+
bool(false)
213225

214226
--unset var--
215-
bool(true)
227+
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
228+
bool(false)

0 commit comments

Comments
 (0)