summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strip_tags_variation6.phpt
blob: c838970868297d0cf5f1af9382b9259a58fceac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
Test strip_tags() function : usage variations - binary safe checking
--INI--
short_open_tag = on
--FILE--
<?php
/* Prototype  : string strip_tags(string $str [, string $allowable_tags])
 * Description: Strips HTML and PHP tags from a string
 * Source code: ext/standard/string.c
*/

/*
 * testing whether strip_tags() is binary safe or not
*/

echo "*** Testing strip_tags() : usage variations ***\n";

//various string inputs
$strings = array (
  "<html> I am html string </html>".chr(0)."<?php I am php string ?>",
  "<html> I am html string\0 </html><?php I am php string ?>",
  "<a>I am html string</a>",
  "<html>I am html string</html>".decbin(65)."<?php I am php string?>"
);

//loop through the strings array to check if strip_tags() is binary safe
$iterator = 1;
foreach($strings as $value)
{
      echo "-- Iteration $iterator --\n";
      var_dump( strip_tags($value) );
      $iterator++;
}

echo "Done";
?>
--EXPECTF--
*** Testing strip_tags() : usage variations ***
-- Iteration 1 --
string(18) " I am html string "
-- Iteration 2 --
string(18) " I am html string "
-- Iteration 3 --
string(16) "I am html string"
-- Iteration 4 --
string(23) "I am html string1000001"
Done