Problem/Motivation

If using PHP 8.1 (which is supported in Drupal 9.3.x), you get this error message (the error is reported for custom_body_class.module line 122).

N.B. PHP 8.1 will be a requirement for Drupal 10.

Steps to reproduce

Configure your server to use PHP 8.1. Edit a node and save.

Proposed resolution

The error has been reported and fixed on other modules (see https://www.drupal.org/project/views_aggregator/issues/3252703 for instance)

CommentFileSizeAuthor
#3 3272179-3.patch886 bytestmaiochi
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

quimic created an issue. See original summary.

tmaiochi’s picture

Assigned: Unassigned » tmaiochi

I'll work on this!

tmaiochi’s picture

Assigned: tmaiochi » Unassigned
Status: Active » Needs review
StatusFileSize
new886 bytes

I fixed the error message in this patch, kindly review it!

quimic’s picture

@tmaiochi Thank you for you quick fix.

After testing I can confirm that the error is gone.

Guilherme Rabelo’s picture

Assigned: Unassigned » Guilherme Rabelo

Hi, i will test if the error is gone.

Guilherme Rabelo’s picture

Assigned: Guilherme Rabelo » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi, i applied the #3 patch, enabled the module and add a custom css class for an article. Then i saved the edit to the article and checked the log to see if the error persisted. This patch solved the error of this issue, everything seems to be correct for me.
Moving to RTBC!

slawomir’s picture

Heyyo, the patch cleared the error - thank you! When I add a class on a post now, it all seems to save ok. That said, the class does not get added... and when I return to edit the post, the field is blank again...

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

  • gueguerreiro committed 33cf346 on 8.x-1.x
    Issue #3272179: PHP 8.1: Deprecated function: preg_match(): Passing null...
gueguerreiro’s picture

Status: Reviewed & tested by the community » Fixed

Terribly sorry everyone, it seems I did not have e-mail notifications enabled for this project 😅 so I've been missing quite a lot of issues.

I've committed a fix and pushed it to a new release.

I'll be looking at the remaining outstanding issues over the weekend, it seems some other things are not entirely OK with the module.

Status: Fixed » Closed (fixed)

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