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