From 950caf6998d2324cb98d795ea0957175f08984b8 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 17 Feb 2015 14:02:55 +0100 Subject: [PATCH] test 4-byte sequences --- php_http_utf8.h | 2 +- tests/urlparser010.phpt | 13 +++++++++---- tests/urlparser011.phpt | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 tests/urlparser011.phpt diff --git a/php_http_utf8.h b/php_http_utf8.h index d67910f..2503f06 100644 --- a/php_http_utf8.h +++ b/php_http_utf8.h @@ -555,7 +555,7 @@ static inline size_t utf8towc(unsigned *wc, const unsigned char *uc, size_t len) { unsigned char ub = utf8_mblen[*uc]; - if (!ub || ub > len || ub > 3) { + if (!ub || ub > len || ub > 4) { return 0; } diff --git a/tests/urlparser010.phpt b/tests/urlparser010.phpt index 71f6943..ae63ae7 100644 --- a/tests/urlparser010.phpt +++ b/tests/urlparser010.phpt @@ -1,19 +1,24 @@ --TEST-- -url parser multibyte/utf-8/topct +url parser multibyte/locale/topct --SKIPIF-- --FILE-- DONE @@ -27,7 +32,7 @@ object(http\Url)#%d (8) { ["pass"]=> string(12) "pa%C3%9Fwort" ["host"]=> - string(11) "sörver.net" + string(15) "𐌀𐌁𐌂.it" ["port"]=> NULL ["path"]=> diff --git a/tests/urlparser011.phpt b/tests/urlparser011.phpt new file mode 100644 index 0000000..5dbd82a --- /dev/null +++ b/tests/urlparser011.phpt @@ -0,0 +1,40 @@ +--TEST-- +url parser multibyte/utf-8/topct +--SKIPIF-- + +--FILE-- + +DONE +--EXPECTF-- +Test +object(http\Url)#%d (8) { + ["scheme"]=> + string(4) "http" + ["user"]=> + string(4) "mike" + ["pass"]=> + string(12) "pa%C3%9Fwort" + ["host"]=> + string(15) "𐌀𐌁𐌂.it" + ["port"]=> + NULL + ["path"]=> + string(15) "/for/%E2%82%AC/" + ["query"]=> + string(9) "by=%C2%A2" + ["fragment"]=> + string(6) "%C3%B8" +} +DONE -- 2.30.2