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
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
Comment #2
enorm commentedComment #5
ritarshi_chakraborty commentedYes @enorm, you need to open another issue request for drupal core.
Comment #6
ritarshi_chakraborty commentedThe remaining three test failures don't appear to be related to the
datetimeRangeYears()fix.Comment #9
jrockowitz commentedComment #11
enorm commentedthanks @jrockowitz && thanks @ritarshi_chakraborty
nice solution to build array in parts;
merge worked perfectly!
greetings, Erich
Comment #12
enorm commented#5 @ritarshi_chakraborty: issue requested for core #3556851
thank you, Erich