Re: [RFC] Remove \0 from default trim() character mask

From: Date: Wed, 25 Mar 2026 14:47:31 +0000
Subject: Re: [RFC] Remove \0 from default trim() character mask
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-130452@lists.php.net to get a copy of this message
Hi, On Wed, Mar 25, 2026 at 11:04 AM Marco Pivetta <ocramius@gmail.com> wrote: > > On Tue, 24 Mar 2026 at 19:29, Levi Morrison <levi.morrison@datadoghq.com> > wrote: > >> There hasn't been much discussion, so dear internals: are simply busy, >> un-opinionated, or what? >> > > I'd vote against this proposal: \0 being considered one of > the stripped > characters is now a downstream assumption, and this ends up being a BC > break with little to no advantages. > > From a semantic perspective, \n, > \t and \r are also "control > characters" in other contexts (not the C world). > Thanks for putting this into clear works: this is exactly my fear too. Since the very first message of this thread arrived here, my thoughts were along the lines this is outright dangerous to do: there is "decades" of downstream assumption how this works and it's IMPOSSIBLE to properly vet this, as this operates often on the (potentially untrusted) input level. And, AFAICS, a perfectly valid workaround is possible by just providing as custom 2nd arg. IM(H)O this should never come to a vote, doing this shouldn't even be considered. sincerely, - Markus

« previous php.internals (#130452) next »