Make the Entity Translation module compatible with PHP 7.4 and 8.0.

CommentFileSizeAuthor
#4 entity_translation-n3208034-4.patch639 bytesdamienmckenna
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

The Metatag tests ran into the following error in entity_translation:

exception: [Deprecated function] Line 1681 of sites/all/modules/entity_translation/includes/translation.handler.inc:
usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero
damienmckenna’s picture

Issue tags: +PHP 8.0, +DrupalFest2021
damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new639 bytes

This updates EntityTranslationDefaultHandler::translationTabSort() so it returns the correct arguments for usort().

stefanos.petrakis’s picture

Hi @DamienMcKenna, thanks for bringing this up.

The patch in #4 is packing a bit of change with it, this method has been working under the hood with just 0s and 1s so far, no negatives.
I was wondering if wrapping the existing code inside e.g. intval() would be sufficient while solving the PHP8 compatibility issue for this part of the code.

Does that mean the rest of the codebase is PHP8 compatible, did you by any chance check that too?

damienmckenna’s picture

I didn't check anything else, I just ran into this one specific thing while testing Metatag. The PHP 8 tests show a few other problems, so I suspect there might need to be some more work done.

stefanos.petrakis’s picture

Almost there, this should fix the reported fails for 7.4 and 8.0

stefanos.petrakis’s picture

Hi @DamienMcKenna, this needed a couple of different things to get it to work.
Any chance you could review the current state?

stefanos.petrakis’s picture

Title: PHP 8.0 compatibility for Entity Translation » PHP 7.4 and 8.0 compatibility for Entity Translation
Issue tags: +PHP 7.4
joseph.olstad’s picture

Tests are looking very green!

i18n now has the fixes we need here.

stefanos.petrakis’s picture

It would be great to have some review/feedback for this one, it would trigger a new minor release, offering PHP 7.4 and 8.0 support.

joseph.olstad’s picture

I have been using php 7.4 on at least one project recently and using entity_translation, no issues however its not using workbench moderation. I do have a good recipe for workbench moderation with entity_translation , however those projects aren't using php 7.4 yet.

I haven't yet tried php 8.0 yet but probably soon

stefanos.petrakis’s picture

Issue summary: View changes
Status: Needs review » Fixed

I am going to commit this, got the testbot to support my code changes here.
I find that extending compatibility support to 8.0 is must at this point in time for users of ET.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

joseph.olstad’s picture

Hi @stephanos, please make sure this goes into a tagged release soon, upstream core is fixed, they just fixed the last known php 7.4 related core bug and it also helps PHP 8.0

now several of my contrib projects are passing all PHP 8.0 tests with the latest core update