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