| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
We can add FILTER_FLAG_EMPTY_STRING_NULL:
<?php
- function filter_sanitize_string(mixed $value, int $flags = 0): string|false {
+ function filter_sanitize_string(mixed $value, int $flags = 0): string|false|null {
+ if ($flags & FILTER_FLAG_EMPTY_STRING_NULL && $value === "") {
+ return null;
+ }
?>
For FILTER_FLAG_STRIP_BACKTICK, there is a bug history
(https://bugs.php.net/bug.php?id=69202)
so I did not attempt to code compatility through version history.
----
Server IP: 206.189.2.9
Probable Submitter: 2604:3d08:5e7b:f300:649d:ed01:f6c5:7ae7
----
Manual Page -- https://php.net/manual/en/filter.constants.php
Edit -- https://main.php.net/note/edit/130651
Del: integrated -- https://main.php.net/note/delete/130651/integrated
Del: useless -- https://main.php.net/note/delete/130651/useless
Del: bad code -- https://main.php.net/note/delete/130651/bad+code
Del: spam -- https://main.php.net/note/delete/130651/spam
Del: non-english -- https://main.php.net/note/delete/130651/non-english
Del: in docs -- https://main.php.net/note/delete/130651/in+docs
Del: other reasons-- https://main.php.net/note/delete/130651
Reject -- https://main.php.net/note/reject/130651
Search -- https://main.php.net/manage/user-notes.php