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():
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | linkit-jsonserialize-3262401-11.patch | 1.75 KB | berdir |
| #2 | phph8_deprecations--3262401-2.patch | 1.95 KB | dom. |
Comments
Comment #2
dom. commentedpatch attached: it seams that the :mixed return of JsonSerializable interface missing from prototype in suggesters.
Comment #4
bohus ulrychHi all,
thanks @dom for this patch
It works well with 6.0.0-beta3, and PHP 8.1.3
Comment #5
wweibel commentedI 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.
Comment #6
ckrinaThanks 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.
Comment #8
eric_a commentedThe 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.
Comment #9
berdirCorrect, this needs to use #[\ReturnTypeWillChange] above the function, like for example \Drupal\Core\GeneratedLink::jsonSerialize.
Comment #10
eric_a commentedComment #11
berdirLike this.
Comment #12
eric_a commentedThanks, @Berdir!
Comment #13
grimreaperHi,
Thanks everyone!
I applied patch from comment 11 on 6.0.0-beta3, it fixed the problem.
Comment #16
johnwebdev commentedThanks!
Comment #18
bserem commentedThis probably qualifies for a new beta release, since php 7.4 is going EOL in 6 days.
Comment #19
joelpittetYes new beta please :D
Comment #20
kreatil commented+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)
Comment #21
douggreen commentedPlease tag a new release with this.
Comment #22
sascha_meissnerThis issue also applies to 6.0.0-beta3, applied patch #11 and it fixed the issue
Comment #23
samlerner commentedI 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!
Comment #24
aaron.ferris commentedAnother +1 for a release please!!
Comment #25
mark_fullmerThis 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.
Comment #26
samlerner commentedAh! 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.
Comment #27
aaron.ferris commentedWe are on 6.0.0-beta3 as well, will look to move to the 7/7 release so ignore me! Thanks.