xref: /PHP-8.2/ext/filter/tests/025.phpt (revision bf94010b)
1--TEST--
2filter_var() and FILTER_SANITIZE_STRING
3--EXTENSIONS--
4filter
5--FILE--
6<?php
7
8var_dump(filter_var("", FILTER_SANITIZE_STRING));
9var_dump(filter_var("<>", FILTER_SANITIZE_STRING));
10var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
11var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP));
12var_dump(filter_var("<>`1234567890", FILTER_SANITIZE_STRING));
13var_dump(filter_var("`123`", FILTER_SANITIZE_STRING));
14var_dump(filter_var(".", FILTER_SANITIZE_STRING));
15
16echo "Done\n";
17?>
18--EXPECTF--
19Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
20string(0) ""
21
22Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
23string(0) ""
24
25Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
26string(12) "!@#$%^&*()'""
27
28Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
29string(24) "!@#$%^&#38;*()&#39;&#34;"
30
31Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
32string(11) "`1234567890"
33
34Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
35string(5) "`123`"
36
37Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in %s on line %d
38string(1) "."
39Done
40