From a40e2c843c7b35d0b6b6cb1516823d83bc0a2a81 Mon Sep 17 00:00:00 2001 From: Raghubansh Kumar Date: Sat, 29 Sep 2007 09:03:22 +0000 Subject: [PATCH] New testcases for htmlspecialchars_decode() function --- .../htmlspecialchars_decode_basic.phpt | 53 ++++ .../htmlspecialchars_decode_error.phpt | 37 +++ .../htmlspecialchars_decode_variation1.phpt | 227 ++++++++++++++ .../htmlspecialchars_decode_variation2.phpt | 288 ++++++++++++++++++ .../htmlspecialchars_decode_variation3.phpt | 127 ++++++++ .../htmlspecialchars_decode_variation4.phpt | 93 ++++++ .../htmlspecialchars_decode_variation5.phpt | 140 +++++++++ .../htmlspecialchars_decode_variation6.phpt | Bin 0 -> 1767 bytes 8 files changed, 965 insertions(+) create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_error.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt create mode 100644 ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt new file mode 100644 index 0000000000..4acff8b61f --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test htmlspecialchars_decode() function : basic functionality +--FILE-- + Sam's height. 13 < 25. 1111 & 0000 = 0000. "double quoted string" +$single_quote_string = "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""; +$double_quote_string = "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string ""; + +// Calling htmlspecialchars_decode() with default arguments +var_dump( htmlspecialchars_decode($single_quote_string) ); +var_dump( htmlspecialchars_decode($double_quote_string) ); + +// Calling htmlspecialchars_decode() with optional 'quote_style' argument +var_dump( htmlspecialchars_decode($single_quote_string, ENT_COMPAT) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_COMPAT) ); +var_dump( htmlspecialchars_decode($single_quote_string, ENT_NOQUOTES) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_NOQUOTES) ); +var_dump( htmlspecialchars_decode($single_quote_string, ENT_QUOTES) ); +var_dump( htmlspecialchars_decode($double_quote_string, ENT_QUOTES) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing htmlspecialchars_decode() : basic functionality *** +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +string(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : basic functionality *** +unicode(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(92) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(102) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +unicode(82) "Roy's height > Sam's height. 13 < 25. 1111 & 0000 = 0000. " double quoted string "" +Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt new file mode 100644 index 0000000000..f4201d2842 --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test htmlspecialchars_decode() function : error conditions +--FILE-- +hello & > < " ' world"; +$quote_style = ENT_COMPAT; +$extra_arg = 10; +var_dump( htmlspecialchars_decode($string, $quote_style, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing htmlspecialchars_decode() : error conditions *** + +-- Testing htmlspecialchars_decode() function with Zero arguments -- + +Warning: htmlspecialchars_decode() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing htmlspecialchars_decode() function with more than expected no. of arguments -- + +Warning: htmlspecialchars_decode() expects at most 2 parameters, 3 given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt new file mode 100644 index 0000000000..6773340853 --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt @@ -0,0 +1,227 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - unexpected values for 'string' argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + //resource + $file_handle +); + +// loop through each element of the array for string +$iterator = 1; +foreach($values as $value) { + echo "-- Iterator $iterator --\n"; + var_dump( htmlspecialchars_decode($value) ); + $iterator++; +}; + +// close the file resource used +fclose($file_handle); + +echo "Done"; +?> +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iterator 1 -- +string(1) "0" +-- Iterator 2 -- +string(1) "1" +-- Iterator 3 -- +string(5) "12345" +-- Iterator 4 -- +string(5) "-2345" +-- Iterator 5 -- +string(4) "10.5" +-- Iterator 6 -- +string(5) "-10.5" +-- Iterator 7 -- +string(12) "105000000000" +-- Iterator 8 -- +string(7) "1.06E-9" +-- Iterator 9 -- +string(3) "0.5" +-- Iterator 10 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 11 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 12 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 13 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 14 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 15 -- +string(0) "" +-- Iterator 16 -- +string(0) "" +-- Iterator 17 -- +string(1) "1" +-- Iterator 18 -- +string(0) "" +-- Iterator 19 -- +string(1) "1" +-- Iterator 20 -- +string(0) "" +-- Iterator 21 -- +string(0) "" +-- Iterator 22 -- +string(0) "" +-- Iterator 23 -- +string(12) "ClassAObject" +-- Iterator 24 -- +string(0) "" +-- Iterator 25 -- +string(0) "" +-- Iterator 26 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iterator 1 -- +unicode(1) "0" +-- Iterator 2 -- +unicode(1) "1" +-- Iterator 3 -- +unicode(5) "12345" +-- Iterator 4 -- +unicode(5) "-2345" +-- Iterator 5 -- +unicode(4) "10.5" +-- Iterator 6 -- +unicode(5) "-10.5" +-- Iterator 7 -- +unicode(12) "105000000000" +-- Iterator 8 -- +unicode(7) "1.06E-9" +-- Iterator 9 -- +unicode(3) "0.5" +-- Iterator 10 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 11 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 12 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 13 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 14 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL +-- Iterator 15 -- +unicode(0) "" +-- Iterator 16 -- +unicode(0) "" +-- Iterator 17 -- +unicode(1) "1" +-- Iterator 18 -- +unicode(0) "" +-- Iterator 19 -- +unicode(1) "1" +-- Iterator 20 -- +unicode(0) "" +-- Iterator 21 -- +unicode(0) "" +-- Iterator 22 -- +unicode(0) "" +-- Iterator 23 -- +unicode(12) "ClassAObject" +-- Iterator 24 -- +unicode(0) "" +-- Iterator 25 -- +unicode(0) "" +-- Iterator 26 -- + +Warning: htmlspecialchars_decode() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt new file mode 100644 index 0000000000..5a7432c6fa --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt @@ -0,0 +1,288 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - unexpected values for 'quote_style' argument +--FILE-- + Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string " +$string = "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string ""; + +//get a class +class classA { + function __toString() { + return "Class A Object"; + } +} + +//get a resource variable +$file_handle = fopen(__FILE__, "r"); + +//get an unset variable +$unset_var = 10; +unset($unset_var); + +//array of values to iterate over +$values = array( + + // float data + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + //resource + $file_handle +); + +// loop through each element of the array for quote_style +$iterator = 1; +foreach($values as $value) { + echo "\n-- Iteration $iterator --\n"; + var_dump( htmlspecialchars_decode($string, $value) ); + $iterator++; +} + +// close the file resource used +fclose($file_handle); + +echo "Done"; +?> +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** + +-- Iteration 1 -- +string(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 2 -- +string(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 3 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 4 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 5 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 6 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 11 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 12 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 13 -- +string(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 14 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 15 -- +string(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 16 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 17 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 22 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 23 -- +string(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 24 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** + +-- Iteration 1 -- +unicode(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 2 -- +unicode(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 3 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 4 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 5 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 6 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 8 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 9 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 10 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, array given in %s on line %d +NULL + +-- Iteration 11 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 12 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 13 -- +unicode(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 14 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 15 -- +unicode(104) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 16 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 17 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 19 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 20 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, Unicode string given in %s on line %d +NULL + +-- Iteration 21 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, object given in %s on line %d +NULL + +-- Iteration 22 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 23 -- +unicode(114) "Roy's height > Sam's height. 13 < 15. 1111 & 0000 = 0000. " double quote string "" + +-- Iteration 24 -- + +Warning: htmlspecialchars_decode() expects parameter 2 to be long, resource given in %s on line %d +NULL +Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt new file mode 100644 index 0000000000..cab643a7a9 --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt @@ -0,0 +1,127 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - heredoc strings for 'string' argument +--FILE-- +Roy's height > Sam's height +13 < 25 +1111 & 0000 = 0000 +"This is a double quoted string" +EOT; + +// heredoc with diferent whitespaces +$diff_whitespaces = <<Roy's height\r > Sam\t's height +1111\t\t & 0000\v\v = \f0000 +" heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces" +EOT; + +// heredoc with numeric values +$numeric_string = <<11 < 12. 123 string 4567 +"string" 1111\t & 0000\t = 0000\n; +EOT; + +// heredoc with quote chars & slash +$quote_char_string = <<< This's a string with quotes: +"strings in double quote" & +'strings in single quote' " +this\line is 'single quoted' /with\slashes +EOT; + +$res_heredoc_strings = array( + //heredoc strings + $empty_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// loop through $res_heredoc_strings array and check the working on htmlspecialchars_decode() +$count = 1; +for($index =0; $index < count($res_heredoc_strings); $index ++) { + echo "-- Iteration $count --\n"; + var_dump( htmlspecialchars_decode($res_heredoc_strings[$index]) ); + $count++; +} + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(103) "Roy's height > Sam's height +13 < 25 +1111 & 0000 = 0000 +"This is a double quoted string"" +-- Iteration 4 -- +string(130) "Roy's height + > Sam 's height +1111 & 0000 = 0000 +" heredoc +double quoted string. with different white spaces"" +-- Iteration 5 -- +string(62) "11 < 12. 123 string 4567 +"string" 1111 & 0000 = 0000 +;" +-- Iteration 6 -- +string(153) "< This's a string with quotes: +"strings in double quote" & +'strings in single quote' " +this\line is 'single quoted' /with\slashes " +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +unicode(0) "" +-- Iteration 2 -- +unicode(0) "" +-- Iteration 3 -- +unicode(103) "Roy's height > Sam's height +13 < 25 +1111 & 0000 = 0000 +"This is a double quoted string"" +-- Iteration 4 -- +unicode(130) "Roy's height + > Sam 's height +1111 & 0000 = 0000 +" heredoc +double quoted string. with different white spaces"" +-- Iteration 5 -- +unicode(62) "11 < 12. 123 string 4567 +"string" 1111 & 0000 = 0000 +;" +-- Iteration 6 -- +unicode(153) "< This's a string with quotes: +"strings in double quote" & +'strings in single quote' " +this\line is 'single quoted' /with\slashes " +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt new file mode 100644 index 0000000000..43f91bfd6c --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument +--FILE-- + +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(100) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +string(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(98) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +-- Iteration 3 -- +string(48) "\nRoy's height >\t; Sam's\v height\f" +string(48) "\nRoy's height >\t; Sam's\v height\f" +string(48) "\nRoy's height >\t; Sam's\v height\f" +string(38) "\nRoy's height >\t; Sam's\v height\f" +-- Iteration 4 -- +string(48) "\r\tRoy's height >\r; Sam\t's height" +string(48) "\r\tRoy's height >\r; Sam\t's height" +string(48) "\r\tRoy's height >\r; Sam\t's height" +string(38) "\r\tRoy's height >\r; Sam\t's height" +-- Iteration 5 -- +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +unicode(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(90) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(100) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(85) "Roy's height > Sam's \$height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +unicode(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +unicode(88) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +unicode(98) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +unicode(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string "" +-- Iteration 3 -- +unicode(48) "\nRoy's height >\t; Sam's\v height\f" +unicode(48) "\nRoy's height >\t; Sam's\v height\f" +unicode(48) "\nRoy's height >\t; Sam's\v height\f" +unicode(38) "\nRoy's height >\t; Sam's\v height\f" +-- Iteration 4 -- +unicode(48) "\r\tRoy's height >\r; Sam\t's height" +unicode(48) "\r\tRoy's height >\r; Sam\t's height" +unicode(48) "\r\tRoy's height >\r; Sam\t's height" +unicode(38) "\r\tRoy's height >\r; Sam\t's height" +-- Iteration 5 -- +unicode(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +unicode(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +unicode(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +unicode(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12" +Done diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt new file mode 100644 index 0000000000..0f14a92503 --- /dev/null +++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt @@ -0,0 +1,140 @@ +--TEST-- +Test htmlspecialchars_decode() function : usage variations - double quoted strings for 'string' argument +--FILE-- + +--EXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(99) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +string(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +string(82) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +string(82) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +string(92) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +string(72) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +-- Iteration 3 -- +string(44) " +Roy's height > ; Sam's height " +string(44) " +Roy's height > ; Sam's height " +string(44) " +Roy's height > ; Sam's height " +string(34) " +Roy's height > ; Sam's height " +-- Iteration 4 -- +string(44) " + Roy's height > +; Sam 's height" +string(44) " + Roy's height > +; Sam 's height" +string(44) " + Roy's height > +; Sam 's height" +string(34) " + Roy's height > +; Sam 's height" +-- Iteration 5 -- +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +string(30) " + 1 3 & gt; 11 but 11 & lt; 12" +Done +--UEXPECTF-- +*** Testing htmlspecialchars_decode() : usage variations *** +-- Iteration 1 -- +unicode(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(89) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(99) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +unicode(84) "Roy's height > Sam's $height... 1111 ≈ 0000 = 0000... " double quote string "" +-- Iteration 2 -- +unicode(82) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +unicode(82) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +unicode(92) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +unicode(72) "Roy's height > Sam's height... 13 < 15... + + " double quote string "" +-- Iteration 3 -- +unicode(44) " +Roy's height > ; Sam's height " +unicode(44) " +Roy's height > ; Sam's height " +unicode(44) " +Roy's height > ; Sam's height " +unicode(34) " +Roy's height > ; Sam's height " +-- Iteration 4 -- +unicode(44) " + Roy's height > +; Sam 's height" +unicode(44) " + Roy's height > +; Sam 's height" +unicode(44) " + Roy's height > +; Sam 's height" +unicode(34) " + Roy's height > +; Sam 's height" +-- Iteration 5 -- +unicode(30) " + 1 3 & gt; 11 but 11 & lt; 12" +unicode(30) " + 1 3 & gt; 11 but 11 & lt; 12" +unicode(30) " + 1 3 & gt; 11 but 11 & lt; 12" +unicode(30) " + 1 3 & gt; 11 but 11 & lt; 12" +Done \ No newline at end of file diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt new file mode 100644 index 0000000000000000000000000000000000000000..454c61f63a902830d9c26468759cbed0d9aa3404 GIT binary patch literal 1767 zcmc&!T~FIE6y>#sA8{8|Q&UJw8SnsOJU|ghOhO`)CM^?klbgm{uru2!bkqL(uJb`# zG$tg37Db9=`<{F5ImZctaC{vG0SnPs$n0%y3XBEM$EGPXiVIDpdd zDZ-3v!QG010473mJqN>6WI=FtaXBW$_s2z6uwfsrw6e<13k0e*Rtq_OvQx9&ZN6W& zKu8PSAEmN*W9&S~uReo5oT7=fC>((UI8kzj+CoDe&clzFfYJ&p(7=Sp-@z(y6YsCR`^&C&D0R{UIar?x-bc9Ot_XZHD?u?mh_WwvYmp2B~a? zgmI?8>-YQMg#MQT{@)~~!bp0D#AxV*SEXr%6tXC-VU1u0j(}^;=g?ySUS!WP&lN=7 zJEijkyg{7l-nKvRqPK7SFhim{g^5;o5>j;!-^$wp6Hufk(5R7(QpowwIV5Tt&4|I) z3aVG3M${&nL9`8FMgq{wDIK{;B66g1yDFP_i|tw@+9%L-=}dhjuI)6mPx%wKJa_g* z&4}KB773uYzejV_^Hn@N=2rscN)^Ojt8$vTDH;+)s}iP40#YPI`fMjzS5R)aB}0#3 zbjVVrk;hr@L3M7ROEZ_~!!MG^J+^Ea|vr{FJLUR0pF5&p|)%YYlqkH(0&=JrQ{}B*eZI@FYyiP5DldiRAg{rgh z5UF+Mtv1+MYOuSrXix{u>#W1t%jU(lf2c+-KEOCQCrz& pva=k?#{SW^dqyi!bXE}Vr&qI~l%o1Izn%|mhyQ9sOX7u2`~h|{IO_la literal 0 HcmV?d00001 -- 2.50.1