Problem/Motivation

Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\sharethis\SharethisManager->toBoolean() (line 205 of modules/contrib/sharethis/src/SharethisManager.php).

Proposed resolution

Multiple possibilities exist:

  • null-coalesce $val to empty string: if (strtolower(trim($val ?? '')) === 'false') {</li>
  • wrap it in double quotes: if (strtolower(trim("$val")) === 'false') { seems nicer
  • swapping trim and strtolower would only move the notice to strtolower instead of trim, so not a solution

Remaining tasks

Review patch.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#9 3265914-trim-php81.patch446 bytesvlyalko
#2 3265914-php81.patch439 bytesfgm

Issue fork sharethis-3265914

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

fgm created an issue. See original summary.

fgm’s picture

Status: Active » Needs review
StatusFileSize
new439 bytes

Patch attached

londova’s picture

Dear Maintainers,
Do you really need over 4 month to review a patch?

drupgirl’s picture

Status: Needs review » Reviewed & tested by the community

ty for the patch +1 RTBC

voleger made their first commit to this issue’s fork.

voleger’s picture

just created the MR from #2. hope this will help merge changes faster
+1 for rtbc

rajab natshah’s picture

Thank you, Frédéric, for patch #2

vlyalko’s picture

StatusFileSize
new446 bytes

#2 patch did not work for me. Created this fix, which worked and I have no more errors

vladimiraus’s picture

+1. Working great 🍻
Thank you for patches.

  • VladimirAus committed 9a8a084e on 8.x-2.x authored by vlyalko
    Issue #3265914 by vlyalko, VladimirAus: SharethisManager causes notice...
vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you! Committed! 🥤

Status: Fixed » Closed (fixed)

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