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