Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291399

[D7 PHP 8.1] preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in _locale_parse_js_file()

$
0
0

Problem/Motivation

There is a PHP 8.1 deprecation in _locale_parse_js_file():

Deprecated function: preg_split(): Passing null to parameter #2 ($subject) of type string is deprecated in _locale_parse_js_file() (line 1606 of includes/locale.inc).

We are getting this warning on existing project where the locales_source table has more than 30k records. Some of these records have location set to null (as the database column does not require value).

If the select loads one or more rows with location of null:

$source = db_query("SELECT lid, location FROM {locales_source} WHERE source = :source AND context = :context AND textgroup = 'default'", array(':source' => $string, ':context' => $context))->fetchObject();

Then the deprecation will appear after running this preg_split():

$locations = preg_split('~\s*;\s*~', $source->location);

Steps to reproduce

It seems like that this is not replicable on clean D7 install as we need to have some records with location = null in locales_source table. However this can be replicated in l10n_update module tests, see: https://www.drupal.org/pift-ci-job/2342969

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 291399

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>