Reviewed & tested by the community
Project:
FileField Sources
Version:
2.0.x-dev
Component:
General
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Jan 2023 at 21:12 UTC
Updated:
16 Dec 2025 at 15:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jrglasgow commentedupdated filefield_sources.info.yml and composer.json to include D10 compatibility, including the patch for #3325652: deprecated alter hook hook_field_widget_form_alter()
Comment #4
nickspages commentedTried this patch with my Drupal 10.0.2 and it did not work.
Comment #5
loopy1492 commentedI applied the patch for MR5 to 1x-dev and the Upgrade Status module seems happy with the changes on D9.5.3 with php 8.1.
Comment #6
loopy1492 commented@nickspages did the patch just not apply for you or did you receive some other kind of error?
Comment #7
alexp999 commentedI'm still seeing 49 errors and 2 warnings with the patch in #2 using upgrade status.
Lots of calls to deprecated functions.
Comment #8
jrglasgow commentedI finally have a D10 environment set up to start testing, I will be making some more changes this week.
Comment #9
jrglasgow commentedthis is going to require a major version change as it is not backwards compatible with Drupal 9 or Symfony 4
Comment #10
jrglasgow commentedafter looking at this a little bit more I see that the Symfony 4 version of symfony/http-foundation which contained the MimeTypeGuesserInterface which filefield_sources uses is there, but also symfony/mime ^5.3 which contains the same interface (different namespace) is including in drupal/core since 9.2.0, so this module CAN be compatible with ^9.2 | ^10, so we SHOULDN'T necessarily need a major release.
Comment #11
i-trokhanenkoComment #12
dan.d commentedThis patch seems to be incomplete. There is another issue that needs to be addressed to make this module compatible with D10:
Call to deprecated function file_munge_filename(). Deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Dispatch a \Drupal\Core\File\Event\FileUploadSanitizeNameEvent event instead.
L475 - https://git.drupalcode.org/project/filefield_sources/-/merge_requests/5/...
L596 - https://git.drupalcode.org/project/filefield_sources/-/merge_requests/5/...
Comment #13
dan.d commentedI'm posting the updated version of the patch, which seems to be completing the list of deprecations for D10. Any feedback will be appreciated.
Comment #14
aitala commentedTesting this on D 9.5.11 and it seems to work nicely.
Thanks,
Eric
Comment #15
optasy commentedTested this on a D10 instance, works ok, README.txt file needs to be renamed to README.md.
Comment #16
webengr commentedout of time, 2 weeks till end of life for drupal 9, this is obsolete.
Comment #17
robcarrJust upgraded a couple of sites to D10 and this patch seems to work fine. Thanks for your work.
Needs a bit work to improve on coding standards then test will pass
Comment #18
robcarrSorry, this module needs some basic work to pass tests. Mostly code formatting...
Comment #19
robcarrRunning the module through PHPCS it's riddled with (mostly trivial) coding standards errors. I'll try and do what I can do work on these, but I struggle with tests, so might need support
Other issue I've noticed is that current formal release (8.x-1.0-alpha5) was released 19 January 2022, whereas Dev release is far older (over 2 years since last commit: 24 May 2021). So I'm going to base all my updates on the alpha5 branch
Comment #20
chetan 11 commentedI'm working on the phpcs issues.
Comment #21
robcarrPatch to look at D10 compatibility and address all coding standards issues. Would welcome a review and maybe some additional work will be required on tests.
Have rolled patch agains 1.0-alpha5 as it's much more current then DEV release.. although I suppose that might fail automated tests in itself
Comment #22
robcarrPrevious patch does not apply :(
Comment #23
natkeeran commentedApplied path #13 patch to 1.0-alpha5 ( D10.1.5, php 8.1) . Throws the following error.
Error: Call to undefined method Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser::guess() in filefield_sources_save_file() (line 449 of /var/www/D9-collections3/web/modules/contrib/filefield_sources/filefield_sources.module).Looks like guess method does not exist in D10, and need to use guessMimeType.
Comment #24
bobi-mel commentedComment #25
bobi-mel commented@Natkeeran I fixed. Please check
Comment #26
jamesdriscoll commented8.x-1.0-alpha5 is reporting 55 problems.
I'm happy to test but what's the sequence of patches that need to be applied to get to a 'now fixed' state? (it's clearly more than the mimetype fix)
Comment #27
rschwab commentedI just tested this branch out on a fresh 10.1.7 install and it works just as expected. I tested image, text, and tgz files using upload, remote, reference existing, and attach. The only thing I saw were php warnings that are already noted in #3313074: Warnings while adding a remote file after switching to PHP 8.0.
+1 for RTBC
Comment #28
rschwab commentedMore work is needed to make the test suite happy.
Comment #29
rschwab commentedFor speed and to keep it simple, I'm merging the work from #3168858: drupalPostForm() in functional tests is deprecated and #3408263: Replace deprecated SimpleTest assertions here.
Comment #30
rschwab commentedComment #31
rschwab commentedAs of now all tests are passing, except for 4 failures that would be solved by merging #2840594: Dont use curl, use the drupal client instead . Once that is resolved this should be ready as well.
Comment #34
uridrupal commentedThe last changes broke the code, there's an extra } that has been deleted
Comment #35
danheisel commentedHoping this patch sorts out the missing curlies from the MR above. I saw two in Remote.php. Seems to be running fine now on my sites.
Comment #36
uridrupal commentedSeems patch #35 works fine for me. I have learnt the risk of using a Merge diff as a patch now.
Thanks!
Comment #37
rschwab commentedI think code standards fixes should go into their own issue so as not to confuse the issue at hand. The commits in #32 and the patch in #35 seem to be mistakenly removing needed code in Remote.php.
Comment #38
szato commentedConfirmed: patch #35 works, MR5 has syntax error:
PHP Parse error: Unclosed '{' on line 345 in /var/www/html/web/modules/contrib/filefield_sources/src/Plugin/FilefieldSource/Remote.php on line 351But there is a new 2.0.x branch.
Comment #39
mlncn commentedMade a 2.0.x branch based on all the work here and danheisel's fix. (Gnuget gave me maintainership a week or so ago; if anyone else has put themselves forward let me know!)
If no fatal errors found i think we can finally mark this fixed and keep anything else in follow-up issues.
Comment #40
mlncn commentedComment #41
rschwab commentedThe code in #32 and the patch in #35 both include removal of code from src/Plugin/FileFieldSource/Remote.php that should not be removed. Changing this to Needs Work. My (probably biased) opinion is to take the code up to #29 and have the two folks making code standards changes in #32 do that work in a separate ticket.
Comment #42
szato commented1) diff between MR5 and 2.0.x branch in only the missing closing "}" - fix made in#35:
https://git.drupalcode.org/project/filefield_sources/-/compare/3336268-d...
2) @rschwab, if I'm correct, you are talking about the removed code (from file: Remote.php) in this commit:
https://git.drupalcode.org/project/filefield_sources/-/merge_requests/5/...
3) @jrglasgow can you please (as an author of the MR) edit the MR and change the target branch to 2.0.x?
Comment #43
rschwab commentedComment #44
rschwab commentedTo try and make this as easy as possible, I've opened #3416606: Restore functions to remote.php as a child of this issue. Once that and #2840594: Dont use curl, use the drupal client instead are reviewed and merged I believe this issue will be fully resolved.
Comment #45
rschwab commentedComment #46
rschwab commentedComment #47
rschwab commentedHere's a patch for anyone who would like to get this module working in D10. It incorporates the work as of today in the following issues:
It should apply cleanly against the 2.0.x-dev branch as of today.
Comment #48
sseto commentedWill we get a stable D10 release back soon or should I switch to the dev version and apply the patch from #47?
Thanks!
Comment #49
edboost commented@Sseto: Did you end up trying this? Trying the module with the #47 patch? How did it go?
Comment #50
sseto commentedI swapped to dev version and so far so good :)
Comment #51
jrglasgow commentedI updated the fork to be compatible with Drupal 11 (at least removed Drupal 11 deprecations) I haven't yet tested.
PHP Stan still finds a few more issues of deprecations that were just deprecated in Drupal 10.3 (a few weeks ago at this posting) and aren't being removed until Drupal 12. I didn't want to exclude anyone who isn't on Drupal 10.3 yet.
------ ------------------------------------------------------------------------------------------------------ Line filefield_sources.module ------ ------------------------------------------------------------------------------------------------------ 439 Fetching deprecated class constant EXISTS_RENAME of interface Drupal\Core\File\FileSystemInterface: in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Core\File\FileExists::Rename instead. 446 Fetching deprecated class constant EXISTS_RENAME of interface Drupal\Core\File\FileSystemInterface: in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Core\File\FileExists::Rename instead. 521 Fetching deprecated class constant EXISTS_REPLACE of interface Drupal\Core\File\FileSystemInterface: in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\Core\File\FileExists::Replace instead. ------ ------------------------------------------------------------------------------------------------------Comment #52
jerech commentedThis patch is giving me a mistake: patch -p1 < filefield_sources_d10compat_3336268.patch
Comment #53
alex.mazaltovLooking to the fork implementation for d11 compatibility.
I am wondering if we can generate a patch in an old-school way to test the implementation with alternative commerce Drupal core to make it compatible with d11
Comment #54
c-logemann@alex.mazaltov Do you mean the diff or patch export option of the merge request?
It's at the dropdown menu of the "code" Button on each MR.
For the MR mentioned above it's this:
https://git.drupalcode.org/project/filefield_sources/-/merge_requests/5....
https://git.drupalcode.org/project/filefield_sources/-/merge_requests/5....
Example of how to use with Composer patches and lenient:
https://www.drupal.org/project/boost/issues/3428282#comment-15948406
Comment #56
mlncn commentedBrought all the updates in:
https://git.drupalcode.org/project/filefield_sources/-/commit/642a01f04e...