Problem/Motivation

When using this module with PHP 8.1 deprecation notices are generated:

PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/www/html/web/modules/contrib/forms_steps/src/Service/WorkflowManager.php on line 138
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /var/www/html/web/modules/contrib/forms_steps/src/Service/WorkflowManager.php on line 216

The issue is that the $currentRoute variable may be null but preg_match only accepts the string type.

Steps to reproduce

Use the module with PHP 8.1 and look at the logs.

Proposed resolution

Check that $currentRoute is not null before using it in preg_match

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

chfoidl created an issue. See original summary.

chfoidl’s picture

chfoidl’s picture

Assigned: chfoidl » Unassigned
tahiche’s picture

StatusFileSize
new1.64 KB

I´m a total contributing noob, but i wanted to share a patch based on the above fork, in cas it helps anyone...
It applies to the "8.x-1.5" version.

thtas’s picture

StatusFileSize
new1.45 KB

Updated for latest 8.x-1.x branch

nicoloye’s picture

Status: Needs review » Reviewed & tested by the community

Changes work as a charm, thanks!

  • chfoidl authored a9e2352e on 8.x-1.x
    Issue #3283627 by chfoidl, tahiche, thtas, nicoloye: Fix deprecation on...
nicoloye’s picture

Status: Reviewed & tested by the community » Fixed

Pushed to dev branch. Thanks for the amazing work.

Status: Fixed » Closed (fixed)

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