Reviewed & tested by the community
Project:
Custom Body Class
Version:
2.0.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Mar 2024 at 00:36 UTC
Updated:
1 May 2026 at 16:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
atuliet05 commentedComment #3
atuliet05 commentedI've applied the attached patch and tested this. The reported warning is no longer triggered.
Marking this as RTBC.
Comment #4
mosk commentedI'm using drupal 10.3.1 (with PHP 8.3) and recently installed the Custom Body Class module via Composer. (https://www.drupal.org/project/custom_body_class)
I am still getting the error below even after applying the patch ( https://www.drupal.org/project/custom_body_class/issues/3436902 ) whenever I try to add a custom class to the body of various content types.
ERROR: Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in custom_body_class_node_special_character_form_validate() (line 121 of modules/contrib/custom_body_class/custom_body_class.module).
Comment #5
jaroslav červený commentedI test patch PHP 8.1.20 and Drupal 10.3.1
and error is no longer.
Comment #6
erwangel commentedPatch worked for me.
Comment #7
junaidpvGetting this warning when submitting node type edit form:
Warning: Trying to access array offset on null in custom_body_class_node_special_character_form_validate() (line 118 of modules/contrib/custom_body_class/custom_body_class.module).Here is the improved patch.