Skip to content

Commit 1333b46

Browse files
committed
Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails
1 parent ee21657 commit 1333b46

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/mbstring/mbstring.c

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

20392039
static inline int php_mb_check_code_point(zend_long cp)
20402040
{
2041-
if (cp <= 0 || cp >= 0x110000) {
2041+
if (cp < 0 || cp >= 0x110000) {
20422042
/* Out of Unicode range */
20432043
return 0;
20442044
}

ext/mbstring/tests/bug79448.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails
3+
--SKIPIF--
4+
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
5+
--FILE--
6+
<?php
7+
// 0 is a valid codepoint regardless of encoding
8+
var_dump(mb_substitute_character(0));
9+
?>
10+
--EXPECT--
11+
bool(true)

0 commit comments

Comments
 (0)