Problem/Motivation

Using the module on D9 with PHP8.1 I notice deprecation warning :
Deprecated function : Return type of Drupal\linkit\Suggestion\SimpleSuggestion::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize():

Comments

Dom. created an issue. See original summary.

dom.’s picture

Status: Active » Needs review
StatusFileSize
new1.95 KB

patch attached: it seams that the :mixed return of JsonSerializable interface missing from prototype in suggesters.

Status: Needs review » Needs work

The last submitted patch, 2: phph8_deprecations--3262401-2.patch, failed testing. View results

bohus ulrych’s picture

Hi all,
thanks @dom for this patch
It works well with 6.0.0-beta3, and PHP 8.1.3

wweibel’s picture

I have encountered the same issue, also on 6.0.0-beta3 and PHP 8.1.3. The patch file does correct it for me.

This issue was causing the modal to fail rendering Suggestions since the deprecation warning was being returned in the response body, and then the json parse would error.

ckrina’s picture

Status: Needs work » Reviewed & tested by the community

Thanks for the patch, it solved the problem for me too. Moving to RTBTC although I'm not sure if it's the solution the maintainers want.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: phph8_deprecations--3262401-2.patch, failed testing. View results

eric_a’s picture

The mixed return type declaration implies requiring PHP 8.0 in info.yml. The current patch would explode on platforms 7.3 and 7.4.
So either the info.yml should be amended - but raising requirements should not be done lightly and not just in any branch/ release - or the alternative solution should be chosen.

berdir’s picture

Correct, this needs to use #[\ReturnTypeWillChange] above the function, like for example \Drupal\Core\GeneratedLink::jsonSerialize.

eric_a’s picture

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new1.75 KB

Like this.

eric_a’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @Berdir!

grimreaper’s picture

Hi,

Thanks everyone!

I applied patch from comment 11 on 6.0.0-beta3, it fixed the problem.

  • johnwebdev committed fcb5a58 on 6.0.x
    Issue #3262401 by Dom., Berdir: Deprecated function : Return type of...

  • johnwebdev committed a2436eb on 8.x-5.x
    Issue #3262401 by Dom., Berdir: Deprecated function : Return type of...
johnwebdev’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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

bserem’s picture

This probably qualifies for a new beta release, since php 7.4 is going EOL in 6 days.

joelpittet’s picture

Yes new beta please :D

kreatil’s picture

+1
Came across this issue having Drupal 9 on PHP 8.1 for a month now. The error message cited in the issue name is bumping in every now and then. (Linkit Version: 6.0.0-beta3)

douggreen’s picture

Please tag a new release with this.

sascha_meissner’s picture

This issue also applies to 6.0.0-beta3, applied patch #11 and it fixed the issue

samlerner’s picture

I would love a new release with this patch. I'm upgrading a number of sites to D10 and this module is used by all of them. Thanks in advance!

aaron.ferris’s picture

Another +1 for a release please!!

mark_fullmer’s picture

Another +1 for a release please!!

This change is present in release 6.0.0 (Drupal 9.5 through 10.0.x) and 6.1.0 (Drupal 10.1.x+). Assuming the comment above was requesting a release for 8.x-5.x, I would say that it would be better to update to Linkit version 6, and that should not require any configuration changes in the site.

Let me know if I can clarify if I'm misunderstanding.

samlerner’s picture

Ah! We've been using 6.0.0-beta3 and I didn't notice that a 6.0.0 release was created 4 days ago on July 7th. Sweet!

Since that version is compatible with both D9 and D10, I don't know if we need to have it in the 8.x-5.x branch. I just needed a version that worked in D9 and is D10-compatible as well.

aaron.ferris’s picture

We are on 6.0.0-beta3 as well, will look to move to the 7/7 release so ignore me! Thanks.