Re: [RFC] Warn on conversions from resource to string

From: Date: Tue, 24 Sep 2024 17:21:25 +0000
Subject: Re: [RFC] Warn on conversions from resource to string
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-125669@lists.php.net to get a copy of this message
On Tuesday, 24 September 2024 at 14:24, Christoph M. Becker <cmbecker69@gmx..de> wrote: > On 24.09.2024 at 14:18, Gina P. Banyard wrote: > > > I would like to propose a short RFC about warning on conversions from resources to > > strings, > > similar to what a conversion from array to string does. > > > > Let me know what you think about it: > > https://wiki.php.net/rfc/warn-resource-to-string > > > The ssh2 wrappers[1] used to use this "feature". I'm not sure whether > there is another way to accomplish the same now. If not, that should > probably be done prior to emitting a warning for the resource to string > conversion. > > [1] https://www.php.net/manual/en/wrappers.ssh2.php I guess that it could always use the integer representation of the resource.. Or, more sensibly, be converted to an opaque object that implements a __toString() method. I have encountered some other issues in the engine exposed by this conversion, the biggest one being array_diff/array_intersect, so I could also spend some time working on that extension. Best regards, Gina P. Banyard

« previous php.internals (#125669) next »