Uh oh!
There was an error while loading. Please reload this page.
Convert file_info resources to objects - #5987
Conversation
// cc @frankdejonge Not sure if this affects you? |
Uh oh!
There was an error while loading. Please reload this page.
cmb69
commented
Aug 14, 2020
If there are BC concerns, please say so! :) |
frankdejonge
commented
Aug 14, 2020
@GrahamCampbell If I see this correctly, this is only the function-style interface, the |
cmb69
commented
Aug 14, 2020
Indeed, the OOP interface is completely unaffected. The procedural interface now handles objects, so both could be mixed (which might provide a smoother upgrade path). |
frankdejonge
commented
Aug 14, 2020
Off-topic: if the fopen will become something other than |
Girgias
commented
Aug 14, 2020
The recommended way is to not check for an instanceof an object or use a |
frankdejonge
commented
Aug 14, 2020
While that would work for the code that is opening a file-handle, it is not suitable for accepting one. For Flysystem, for example, the method accepts a resource opened elsewhere, so we need to have a way to check if it's the right input to prevent weird errors. |
Girgias
commented
Aug 14, 2020
As the object does not yet exists (and won't before the conversion is done) the only way would to do a double condition, mind linking to the relevant code? |
frankdejonge
commented
Aug 14, 2020
@Girgias it's this kind of an assertion: https://github.com/thephpleague/flysystem/blob/2.x/src/Filesystem.php#L141 |
You can add |
frankdejonge
commented
Aug 14, 2020
@kocsismate that is correct, however, that was deemed not the best practice by @Girgias. Hence the further discussion. Perhaps we should take this discussion elsewhere since it's derailing the conversation (or preventing it even) about the current PR. |
cmb69
commented
Aug 14, 2020
I can't imagine that we switch stream resources to objects before PHP 9, so probably no need to discuss right now. :) |
cmb69
commented
Aug 21, 2020
If there are no objections, I'll merge this in a week. |
cmb69
commented
Aug 22, 2020
Nope, to late for this change for PHP 8.0. |
GrahamCampbell
commented
Aug 22, 2020
Oh. Gonna be a shame to delay a lot of these changes till 8.1 when not strictly necessary. It will make things harder for library authors to make their code work on both PHP 8.0 and 8.1. |
cmb69
commented
Aug 22, 2020
Well, we're more than 2 weeks after feature freeze, and so such changes would make the upgrade to PHP 8.0 harder for users who already have started that process. |
GrahamCampbell
commented
Aug 22, 2020
I suppose this has already been discussed and decided upon. ;) |
nikic
commented
Aug 24, 2020
Yeah, the release management decision here was to not do further resource -> object conversions past feature freeze. We don't stand a realistic chance of converting all resources to objects in PHP 8.0, some will necessarily happen later, so there's no strong motivation to allow them past feature freeze (unlike the warning -> Error conversions). |
nikic
commented
Oct 26, 2020
853d9c5 to
5976120CompareBesides our general desire to get rid of the legacy resource types, this is particularly appealing for fileinfo, because there are already respective objects.
5976120 to
31164d2Comparecmb69
commented
Dec 19, 2020
Any objections to merging this? |
Besides our general desire to get rid of the legacy resource types,
this is particularly appealing for fileinfo, because there are already
respective objects.
Should probably inline
php_fileinfoinfinfo_objectright away. Also, I wonder about serialization and cloning of finfo objects – is that properly supported?