Re: [RFC] Warn on conversions from resource to string
| From: | Christoph M. Becker | Date: | Tue, 24 Sep 2024 17:53:50 +0000 |
| Subject: | Re: [RFC] Warn on conversions from resource to string | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125671@lists.php.net to get a copy of this message | ||
On 24.09.2024 at 19:21, Gina P. Banyard wrote:
> 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:
>>
>>> 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.
The former would require to change existing code (I presume that this
"feature" is used quite often); the latter would be something that
wouldn't break such code, and be a good idea generally.
> 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.
That would be great. I think that ssh2 is one of the more important
PECL extensions, but unfortunately in low maintenance mode. However,
I'm not sure about the future of libssh2[1].
[1] <https://github.com/libssh2/libssh2/discussions/1249>
Christoph