diff options
author | George Peter Banyard <girgias@php.net> | 2020-04-03 21:16:04 +0200 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-04-03 21:18:45 +0200 |
commit | 1333b46d6dc0c293c1fd626803f91bc69743eb79 (patch) | |
tree | 6155f240cc52be72dba97c0d0cc66e1e20d6d237 /ext/mbstring | |
parent | ee21657a6a2d64e12ba03eae70dd7b7cb2569d82 (diff) | |
download | php-git-1333b46d6dc0c293c1fd626803f91bc69743eb79.tar.gz |
Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails
Diffstat (limited to 'ext/mbstring')
-rw-r--r-- | ext/mbstring/mbstring.c | 2 | ||||
-rw-r--r-- | ext/mbstring/tests/bug79448.phpt | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 0f466a02ee..ba30e05c27 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2038,7 +2038,7 @@ PHP_FUNCTION(mb_detect_order) static inline int php_mb_check_code_point(zend_long cp) { - if (cp <= 0 || cp >= 0x110000) { + if (cp < 0 || cp >= 0x110000) { /* Out of Unicode range */ return 0; } diff --git a/ext/mbstring/tests/bug79448.phpt b/ext/mbstring/tests/bug79448.phpt new file mode 100644 index 0000000000..09052943cc --- /dev/null +++ b/ext/mbstring/tests/bug79448.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails +--SKIPIF-- +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> +--FILE-- +<?php +// 0 is a valid codepoint regardless of encoding +var_dump(mb_substitute_character(0)); +?> +--EXPECT-- +bool(true) |