Problem/Motivation
Using Flag on PHP 8.1 produces the following PHP deprecation message:
Deprecated function: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in Drupal\Core\Access\RouteProcessorCsrf->processOutbound()
Proposed resolution
Fix the deprecation message.
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 5366574-str_replace-null-deprecation.patch | 451 bytes | neclimdul |
| #2 | 3266574-2.patch | 692 bytes | idebr |
Comments
Comment #2
idebr commentedAttached patch fixes the PHP deprecation message when running Flag on PHP 8.1
Comment #3
zengenuity commentedThe patch in #2 works for me.
Comment #4
tr commentedI triggered DrupalCI testing with PHP 8.1 and this patch eliminates the PHP deprecation errors for str_replace().
Comment #5
tr commentedComment #6
gagarine commentedI confirm patch #2 works for me. Tested on live website.
Comment #7
neclimdulThis should suppress the notice but the getDestination should always return a string. The problem is that AJAXactionLink doesn't return the destination when it should.
Comment #8
neclimdulThis should be the correct fix.
Comment #9
tr commentedMuch better. This is why all the issues reported by static analysis should be fixed - they're just problems waiting to happen:
There are at least four other places that also have missing returns.
Note the PHP 8.1 / pgsql-10.12 fails are *branch* failures and have nothing to do with the patch. They need to be addressed in a separate issue.
Comment #10
neclimdul100% agree about static analysis! Glad we can fix two problems with one patch. :-D
Comment #11
trebormcI confirm patch #8 works for me. Tested on PROD website.
Comment #12
pebosi commentedPatch is working for me, too. A new module release would be great.
Comment #13
klemendev commentedRTBC, our logs are filling up by this error and this fixed the issue
Comment #14
agathacrystal#8 is also working for me! Thanks for the patch!
Comment #16
berdirCommitted.
Comment #17
agathacrystalI'm still a little new to the patching process. So forgive me, if im missing something.
After updating my composer.json, the patch cant be applied anymore.
I guess this is because it got 'fixed' - BUT the initial error occurs again.
Comment #18
berdirThe patch is only in the development snapshot, it should still apply if you use the most recent release.
If not, you could try #support or so in slack for support, projects issues (especialy closed ones) aren't really a good place for that.
Comment #19
agathacrystalOk, thanks for the info & sorry!
Comment #21
rajab natshahThanks, using the committed fix
6bde5aa.patch
Hoping for a release tag.
Comment #22
bserem commentedNow that PHP 7.4 is EOL, can we get a new release for flag?
Thanks
Comment #23
nathan tsai commentedJust updating this thread: release 8.4.0-beta4 has this patch applied.
Comment #24
robin_rosh commentedI'm still facing the same issue even after upgrading from 9.5 to 10.5, specifically with flag 5.0
Comment #25
ivnishHow to reproduce this?