From: Matthew Flaschen Date: Wed, 10 Feb 2016 22:52:49 +0000 (-0500) Subject: Add additional test coverage for html_entity_decode X-Git-Tag: php-7.1.0alpha1~617^2~21^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f61429fabf67be15310ed7b8bce29053079d2668;p=php Add additional test coverage for html_entity_decode Will help testing a HHVM fix (https://reviews.facebook.net/D53871) --- diff --git a/ext/standard/tests/strings/bug53021.phpt b/ext/standard/tests/strings/bug53021.phpt index 4a8fbe4f76..38d904761d 100644 --- a/ext/standard/tests/strings/bug53021.phpt +++ b/ext/standard/tests/strings/bug53021.phpt @@ -10,11 +10,14 @@ echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; echo html_entity_decode(""", ENT_QUOTES, 'UTF-8'), "\n"; echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; echo html_entity_decode(""", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("""), "\n"; +echo html_entity_decode("""), "\n"; echo "\nsingle quotes variations:", "\n"; echo html_entity_decode("'", ENT_NOQUOTES, 'UTF-8'), "\n"; echo html_entity_decode("'", ENT_QUOTES, 'UTF-8'), "\n"; echo html_entity_decode("'", ENT_COMPAT, 'UTF-8'), "\n"; +echo html_entity_decode("'"), "\n"; --EXPECT-- array(1) { [1]=> @@ -27,8 +30,11 @@ double quotes variations: " " " +" +" single quotes variations: ' ' ' +' diff --git a/ext/standard/tests/strings/html_entity_decode3.phpt b/ext/standard/tests/strings/html_entity_decode3.phpt index fcf2710679..48cff17bda 100644 --- a/ext/standard/tests/strings/html_entity_decode3.phpt +++ b/ext/standard/tests/strings/html_entity_decode3.phpt @@ -14,6 +14,7 @@ $tests = array( "", "", " ", //allowed always + "'", //single quote, depends on flags "", //DEL "€", //C1 "Ÿ", @@ -76,6 +77,17 @@ foreach ($tests as $t) { } } +echo "\n*** Default options ***\n"; + +foreach ($tests as $t) { + $dec = html_entity_decode($t); + if ($t == $dec) { + echo "$t\tNOT DECODED\n"; + } else { + echo "$t\tDECODED\n"; + } +} + echo "\nDone.\n"; --EXPECT-- *** HTML 4.01 *** @@ -89,6 +101,7 @@ echo "\nDone.\n";  NOT DECODED  NOT DECODED DECODED +' DECODED  NOT DECODED € NOT DECODED Ÿ NOT DECODED @@ -117,6 +130,7 @@ echo "\nDone.\n";  NOT DECODED  NOT DECODED DECODED +' DECODED  DECODED € DECODED Ÿ DECODED @@ -145,6 +159,7 @@ echo "\nDone.\n";  NOT DECODED  NOT DECODED DECODED +' DECODED  NOT DECODED € NOT DECODED Ÿ NOT DECODED @@ -173,6 +188,7 @@ echo "\nDone.\n";  NOT DECODED  NOT DECODED DECODED +' DECODED  DECODED € DECODED Ÿ DECODED @@ -190,4 +206,33 @@ echo "\nDone.\n"; 𯿾 DECODED 𯿿 DECODED +*** Default options *** +� NOT DECODED + NOT DECODED + DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED + NOT DECODED + NOT DECODED + DECODED +' NOT DECODED + NOT DECODED +€ NOT DECODED +Ÿ NOT DECODED +  DECODED +퟿ DECODED +� NOT DECODED +� NOT DECODED + DECODED +￾ DECODED +￿ DECODED +﷏ DECODED +﷐ DECODED +﷯ DECODED +ﷰ DECODED +𯿾 DECODED +𯿿 DECODED + Done.