xref: /PHP-7.1/ext/filter/tests/041.phpt (revision 7af945e2)
1--TEST--
2COOKIE multiple cookie test
3--SKIPIF--
4<?php if (!extension_loaded("filter")) die("skip"); ?>
5--INI--
6filter.default=stripped
7filter.default_flags=0
8--COOKIE--
9abc=dir; def=true; abc=root; xyz="foo bar";
10--FILE--
11<?php
12var_dump($_COOKIE);
13var_dump(filter_has_var(INPUT_COOKIE, "abc"));
14var_dump(filter_input(INPUT_COOKIE, "abc"));
15var_dump(filter_input(INPUT_COOKIE, "def"));
16var_dump(filter_input(INPUT_COOKIE, "xyz"));
17var_dump(filter_has_var(INPUT_COOKIE, "bogus"));
18var_dump(filter_input(INPUT_COOKIE, "xyz", FILTER_SANITIZE_SPECIAL_CHARS));
19?>
20--EXPECT--
21array(3) {
22  ["abc"]=>
23  string(3) "dir"
24  ["def"]=>
25  string(4) "true"
26  ["xyz"]=>
27  string(17) "&#34;foo bar&#34;"
28}
29bool(true)
30string(3) "dir"
31string(4) "true"
32string(9) ""foo bar""
33bool(false)
34string(17) "&#34;foo bar&#34;"
35