[PHP-DEV] Re: Add form feed as a whitespace character in trim, ltrim and rtrim

On Sat, 27 Dec 2025 23:43:56 +0000, Morgan wrote:

On 2025-12-28 11:53, Morgan wrote:

Also in PHP, where ctype_space() recognises \f as whitespace as well as
all of those that trim() removes. (As the name implies, of course, this
is because \f is recognised as whitespace in C.)

Uh, except of course for NUL, which trim() removes.
By the way, I do not think NUL(\x00) should be trimed… In other languages (at least python and rust and libc) NUL is not a whitespace. I therefore opine NUL should be removed from trim in the future, but that is another issue.
I think the BC break would effect some users (every BC break does, but this one could annoy someone expecting \f not to be trim for years using php). I am on the fence about the break too, but I think the change do seems great to me according to other languages’ behaviours. I initially thought this is a bug when I discover this.