Re: [RFC] [Discussion] Resource to object conversion

From: Date: Wed, 22 Nov 2023 18:08:56 +0000
Subject: Re: [RFC] [Discussion] Resource to object conversion
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-121760@lists.php.net to get a copy of this message
> More importantly, it is possible to write cross compatible code, even > without changing anything about is_resource(), if we convert streams to > opaque objects. > It might be tedious and one might need to have redundant instanceof checks > with is_resource() if one does not want to check for a false return, or > duplicate checks for closed resources. > Extensions like GD, IMAP, Curl, and FTP were once very "resource heavy", but they already received this migration with next to none disruptions. Shameless plug here (https://php.watch/articles/resource-object) where I track the progress. As these changes were merged in the last couple years, I spent a few hours grepping the Composer top 1000 packages. There were not that many is_resource checks, and it was quite easy and straightforward to update them to account for the class objects. I'm supportive of our trajectory so far by slowly but steadily moving resource objects to class objects. I also support that we do not modify is_resource to mark resource class objects as a resource. I really look forward to the day that we remove is_resource and kill the final resource object in PHP 🥺.

« previous php.internals (#121760) next »