Add form feed as a whitespace character in trim, ltrim and rtrim
| From: | LamentXU | Date: | Sat, 27 Dec 2025 10:38:21 +0000 |
| Subject: | Add form feed as a whitespace character in trim, ltrim and rtrim | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-129697@lists.php.net to get a copy of this message | ||
Hi Internals,
I have opened a Pull Request to add \f (form feed) to the list of characters stripped by default in
trim(), ltrim(), and rtrim().
Currently, the default behavior of trim() strips the following characters: \n, \r, \t, \v, \0, and
space. The form feed character \f is notably missing, despite being widely recognized as a
whitespace character (in python, rust...).
Although I think this change aligns trim() with standard whitespace definitions, it is technically a
backward compatibility break. I am writing to check if there are any strong objections to this
change or if it requires further discussion.
References:
Issue: https://github.com/php/php-src/issues/20783
Pull Request: https://github.com/php/php-src/pull/20788
Thanks,
Weilin Du