]> granicus.if.org Git - php/commitdiff
Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character...
authorGeorge Peter Banyard <girgias@php.net>
Tue, 7 Apr 2020 20:23:24 +0000 (22:23 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Tue, 7 Apr 2020 20:23:24 +0000 (22:23 +0200)
This commit brings some substantial changes in behaviour due to the weird implementation.
This will be fixed in master due to BC concerns.

This reverts commit 1333b46d6dc0c293c1fd626803f91bc69743eb79.

ext/mbstring/mbstring.c
ext/mbstring/tests/bug79448.phpt [deleted file]

index ba30e05c27d4d4d59fc77c4f8fb4a9275553f37a..0f466a02ee491a6a2b3a887c0e7b056d538d0864 100644 (file)
@@ -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
deleted file mode 100644 (file)
index 0905294..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---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)