Hi developers familiar with webform!

Problem/Motivation

These deprecated functions under php 8.3 are in webform as well as in core because the same function is used.
protected static function datetimeRangeYears($string, $date = NULL) {...
The question is do I have to open another issue request for the same problem in core?

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\webform\Plugin\WebformElement\DateBase::datetimeRangeYears()
(line 678 of modules/contrib/webform/src/Plugin/WebformElement/DateBase.php).
(line 679 of modules/contrib/webform/src/Plugin/WebformElement/DateBase.php).

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\Core\Datetime\Element\DateElementBase::datetimeRangeYears()
(line 49 of core/lib/Drupal/Core/Datetime/Element/DateElementBase.php).
(line 50 of core/lib/Drupal/Core/Datetime/Element/DateElementBase.php).

Steps to reproduce

in a fresh installed drupal 10.5.4 with php 8.3.23 and webform 6.3

problem with:

if (!preg_match($year_pattern, $max_year, $matches)) {
      if (preg_match($plus_pattern, $max_year, $matches)) {

but it's also the same with $min_year;

would be nice if you could provide us with a patch;
I think it's the new syntax rule in php 8.3 which we have to use like:

if (!preg_match($year_pattern, $max_year ?? '', $matches)) {
      if (preg_match($plus_pattern, $max_year ?? '', $matches)) {

thanks and
greetings, Erich

Issue fork webform-3556560

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

enorm created an issue. See original summary.

enorm’s picture

Issue summary: View changes

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

ritarshi_chakraborty’s picture

Yes @enorm, you need to open another issue request for drupal core.

ritarshi_chakraborty’s picture

Status: Active » Needs review

The remaining three test failures don't appear to be related to the datetimeRangeYears() fix.

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

jrockowitz’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

enorm’s picture

thanks @jrockowitz && thanks @ritarshi_chakraborty
nice solution to build array in parts;
merge worked perfectly!
greetings, Erich

enorm’s picture

#5 @ritarshi_chakraborty: issue requested for core #3556851
thank you, Erich

Status: Fixed » Closed (fixed)

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