Problem/Motivation

In https://git.drupalcode.org/project/conditional_fields/-/blob/4.x/src/Con... we're doing a

$values = preg_split("/[\r\n]+/g", $value_data);

There is no /g regex modifier in PHP and it therefore throws the following warning.

Warning: preg_split(): Unknown modifier 'g' in Drupal\conditional_fields\ConditionalFieldsHandlerBase->getConditionValues() (line 37 of modules/contrib/conditional_fields/src/ConditionalFieldsHandlerBase.php).

It most likely came from a regex conversion from JS to PHP, because JS has that modifier.

Steps to reproduce

Proposed resolution

Remove the modifier. It should not have any effect anyhow.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 fix_regex_modifier.patch531 bytessadeghbayan

Comments

szeidler created an issue. See original summary.

sadeghbayan’s picture

StatusFileSize
new531 bytes

Hi @szeidler, thanks for reporting the issue.

here's the patch to fix the issue.

szeidler’s picture

Status: Active » Needs review
szeidler’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

socialnicheguru’s picture

Also worked for me

  • heddn committed b8fd5ec5 on 4.x authored by sadeghbayan
    Issue #3266318 by sadeghbayan, szeidler, heddn: There is no /g regex...
heddn’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the contributions here.

Status: Fixed » Closed (fixed)

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