-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource to opaque object migration #6
Comments
About ZIP, I don't know if it worth the work, as we already have a full OO API. |
@remicollet I was wondering about this a while ago. See my question at php/php-src#5601 (comment) I even had a try at the conversion, but for me, it didn't go as easy as it seemed first, so I stopped. As far as I remember, my main problem was that the data structures used by the OO and procedural interface don't align really well. Is it really the case? If so, then I'd also prefer deprecating the old API. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Because this is an anticipated failure mode of hosting this internal coordination tracker on GitHub, I'm going to err on the side of over-moderation and say: This is not the place to have this discussion. These issues have been discussed extensively on the PHP internals list in the past, and that would also be the place to revisit any decisions. |
BZ2 should be filed under ext/standard/streams |
Edit to add: I just remembered why I never moved on this. |
Okay, expanded idea:
Then callsites look like:
Edit to add: While php_stream_from_zval() doesn't currently throw exceptions, I'm sure we could use a version which does throw a proper TypeError. |
On the other hand.... I've just actually sat down to do grep -r php_stream_to_zval ext/ | wc -l and the answer is only 60. So I may be making a tempest in a teapot. |
PHP 8.0+ is migrating away from the `resource` type in favor of normal classes, see <php/php-tasks#6>. Code should generally check for return values being false rather than using is_resource(). Bug: T260735 Change-Id: Iad84a60b302b22497f7ec1282e4e6223a32ebaeb
For completeness of the list, the following extensions also saw resource to object changes in PHP 8.0:
The status of the Enchant extension is not 100% clear to me. The change from resource to object is mentioned in the changelog, but the associated PR discussion gives the impression that the commit got reverted: php/php-src#5533 |
Another one for which I can't seem to determine the status is SNMP. |
Have a look at commit: php/php-src@cd3e04d for Enchant |
Thanks @Girgias ! |
Me neither, but it seems there is an OOP API as of PHP 5.4.0 (http://github.com/php/php-src/commit/5e82e334ddffcf577542a74a37f3388d14790686) which is not documented at all. PS: oh, it is documented. |
@cmb69 Thanks for taking a look! Still not entirely clear what the change in PHP 8.0 is related to that. Let's hope someone figures it out and adds it to the changelog (if relevant enough) ;-) |
A long term project is to move all extension resources to objects as they are all in all better.
This issue aims to list the remaining usages of resources within php-src
Related RFC: https://wiki.php.net/rfc/resource_to_object_conversion
PHP 8.0:
PHP 8.1:
Scheduled for PHP 8.4:
Scheduled for PHP 9.0:
Remaining:
Persistent resources that are only used internally and not exposed to userland:
The text was updated successfully, but these errors were encountered: