Problem/Motivation
Drupal core 7.79 adds php 8 compatibility however file_entity is not currently passing tests.
Steps to reproduce
Install Drupal core 7.79 and file_entity 7.x-3.x dev and run automated tests on file_entity.
Proposed resolution
Create a patch or merge request
Remaining tasks
Make patch or merge request and review
User interface changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#28 | file_entity-3208277-28.patch | 1.24 KB | joseph.olstad |
Comments
Comment #2
joseph.olstadComment #3
DamienMcKennaComment #4
DamienMcKennaThe testbot shows a number of errors: https://www.drupal.org/pift-ci-job/2019361
Comment #5
DamienMcKennaComment #6
joseph.olstadI added @Taran2L as a maintainer so that I could assign him to this issue to get his attention.
Comment #7
joseph.olstadUnassigned Taran2L , feel free to assign yourself if you have a moment.
Comment #8
DamienMcKennaComment #9
joseph.olstadthen something weird here:
the sudo command not found is likely a testrunner issue
Try to focus on the
FileEntityNormalizerTest.php
first though.Comment #10
DamienMcKennaThis fixes one of the bugs, let's see if it fixes others too.
Comment #11
DamienMcKennaOne of the errors comes from Views: #3189937: PHP 8: Required parameter after optional deprecation notice
I guess we need to tag a new release of Views for PHP 8 compatibility.
Comment #12
joseph.olstadwow great work!
Comment #15
joseph.olstadI committed that change,
keeping this open until the remaining tests are fixed , whether it's upstream or here.
Thanks DamienMcKenna!
Comment #16
joseph.olstadretriggered tests since views release was published
https://www.drupal.org/pift-ci-job/2182265
Comment #17
joseph.olstad@DamienMcKenna, the views fix helped , now there's only one test fail left instead of 2
https://www.drupal.org/pift-ci-job/2182265
File entity access 229 passes, 0 fails, and 6 exceptions
Not sure why
FileEntityAccessTestCase
would cause a new line in the header only when running php 8.0.?
Comment #18
DamienMcKennaThis isn't failing for me locally. Grr..
Comment #19
DamienMcKennaThat one test works correctly for me locally.
Comment #20
joseph.olstad@DamienMcKenna, I get the feeling that the test fail will be resolved once the rules module is tagged and released and once the entity api is tagged and released, both dev branches for these two modules have the fixes for php 8.0
Comment #21
joseph.olstadthere's a chain of events that have to happen for our automated tests to pass, rules needs a new 7.x-2.x tagged release and entity api needs to tag and release, in that order, then we can retrigger our tests here, and then tag and relese both file_entity 7.x-3.x and cherry-pick whatever is necessary for 7.x-2.x to pass also.
Comment #22
joseph.olstadthere's a chain of events that have to happen for us to resolve file_entity and media module php 8.0 automated test passing as media relies on file_entity, which in turn automated tests depend on the entity api which in turn relies on rules for it's automated test coverage dependency.
so , in this order:
Comment #23
joseph.olstadUPDATE:
media is all green now, it was a core fix that did it
queuing file_entity tests now
Comment #24
joseph.olstadah, another update, file_entity tests, still one pesky fail, not sure what the cause is at this time, error comes from core but ?
https://www.drupal.org/pift-ci-job/2231985
Comment #25
mcdruidI don't think this is a problem that's specific to a PHP version; I get the same exceptions testing 7.x-2.x on PHP 7.4 and 8.0
Looks to me like the problem is the Content-Disposition header in
file_entity_download_page()
:Core's
mime_header_encode()
returns output split into chunks separated by newlines:https://git.drupalcode.org/project/drupal/-/blob/7.x/includes/unicode.in...
So this test is generating headers like this:
The newline in the value of the header is what's causing the exception.
So perhaps you need to use a different function to encode the filename which is not going to split it into chunks?
Comment #26
joseph.olstadThanks @mcdruid,
Here is a patch based on what is learned in #25
Comment #27
joseph.olstadComment #28
joseph.olstadthis one instead
Comment #29
joseph.olstadCredit goes to @mcdruid !
Thanks so much @mcdruid!
Great work
Comment #32
joseph.olstadComment #33
joseph.olstadhttps://www.drupal.org/project/file_entity/releases/7.x-3.0-beta19
https://www.drupal.org/project/file_entity/releases/7.x-2.33
Thanks everyone!
Comment #34
mcdruidGreat to have the tests passing, but won't the fixed code still mangle long filenames as each encoded chunk has a prefix and suffix added as well as the newline you're now removing:
I've not tested this - perhaps browsers will understand the prefix/suffix and filenames will be decoded correctly, but I suspect that might not be the case.
Is there a reason you can't just base64_encode the filename?
Comment #35
joseph.olstadI'll keep a close eye on the file_entity queue, with that said, test coverage is pretty strong so I am thinking we're good as-is.