On Mar 24, 2026, at 11:29, Levi Morrison <[email protected]> wrote:
> I agree that \0 is a control byte and not whitespace, so it probably
> shouldn't be included in any of the trim functions. However, at this
> stage in PHP's lifecycle I am not sure if we should fix it.
> 
> There hasn't been much discussion, so dear internals: are simply busy,
> un-opinionated, or what?

For what little it's worth, I can't imagine any practical situation where this 
change would be helpful. Using trim() or its variants on binary data is likely 
to result in that data being corrupted, and this will continue to be the case 
even if NUL is not trimmed. Changing the current behavior is likely to break 
userspace code which depends on the current behavior. If, for some reason, 
users find it useful to trim specific whitespace characters from binary data, 
they can do so by passing a $characters mask to the function to fit their 
needs, rather than changing the function for everyone.

-- Andrew F

Reply via email to