Problem/Motivation

On php 8.1 I get the following error:
Deprecated function: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in gutenberg_form_node_form_alter() (line 455 of modules/contrib/gutenberg/gutenberg.module).

We should probably check the value of $json variable before passing it to json_decode

Proposed resolution

To fix this change line 453 from:
$gutenberg_template = json_decode($config->get($node_type . '_template'));

To:

  $gutenberg_template_json = $config->get($node_type . '_template');
  $gutenberg_template = $gutenberg_template_json ? json_decode($gutenberg_template_json) : null;

I may provide a patch later

Issue fork gutenberg-3358507

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

doxigo created an issue. See original summary.

ranjit1032002’s picture

Assigned: Unassigned » ranjit1032002

ranjit1032002’s picture

Assigned: ranjit1032002 » Unassigned
Status: Active » Needs review

Created MR!48 for the issue mentioned, please review.
Thank You.

dineshkumarbollu’s picture

Hi Ranjit1032002

MR!48 looks fine now it doesn't show the error,

moving +RTBC

Thanks.

gold’s picture

Status: Needs review » Reviewed & tested by the community

Cheers for this @Ranjit1032002,

I have the patch in MR!48 running in 2 environments and the issue is looking to be resolved with that.

+1 for RTBC

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

szeidler’s picture

Status: Reviewed & tested by the community » Fixed

This got committed to dev. Thanks for your contributions.

Status: Fixed » Closed (fixed)

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