1--TEST--
2Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags'
3--FILE--
4<?php
5/*
6 * testing functionality of strip_tags() by giving invalid values for $str and valid values for $allowable_tags argument
7*/
8
9echo "*** Testing strip_tags() : usage variations ***\n";
10
11// unexpected values for $string
12$strings = array (
13  "<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>",
14  '<abc>hello</abc> \t\tworld... <ppp>strip_tags_test</ppp>',
15  "<%?php hello\t world?%>",
16  '<%?php hello\t world?%>',
17  "<<htmL>>hello<</htmL>>",
18  '<<htmL>>hello<</htmL>>',
19  "<a.>HtMl text</.a>",
20  '<a.>HtMl text</.a>',
21  "<nnn>I am not a valid html text</nnn>",
22  '<nnn>I am not a valid html text</nnn>',
23  "<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>",
24  '<nnn>I am a quoted (\") string with special chars like \$,\!,\@,\%,\&</nnn>',
25);
26
27//valid html and php tags
28$quotes = "<p><a><?php<html>";
29
30//loop through the various elements of strings array to test strip_tags() functionality
31$iterator = 1;
32foreach($strings as $string_value)
33{
34      echo "-- Iteration $iterator --\n";
35      var_dump( strip_tags($string_value, $quotes) );
36      $iterator++;
37}
38
39echo "Done";
40?>
41--EXPECT--
42*** Testing strip_tags() : usage variations ***
43-- Iteration 1 --
44string(32) "hello 		world... strip_tags_test"
45-- Iteration 2 --
46string(34) "hello \t\tworld... strip_tags_test"
47-- Iteration 3 --
48string(0) ""
49-- Iteration 4 --
50string(0) ""
51-- Iteration 5 --
52string(18) "<htmL>hello</htmL>"
53-- Iteration 6 --
54string(18) "<htmL>hello</htmL>"
55-- Iteration 7 --
56string(9) "HtMl text"
57-- Iteration 8 --
58string(9) "HtMl text"
59-- Iteration 9 --
60string(26) "I am not a valid html text"
61-- Iteration 10 --
62string(26) "I am not a valid html text"
63-- Iteration 11 --
64string(62) "I am a quoted (") string with special chars like $,\!,\@,\%,\&"
65-- Iteration 12 --
66string(64) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&"
67Done
68