Problem/Motivation

NumericField::render() formats the value and then hands the formatted string to the plural machinery as the count:

$value = number_format($value, $precision, $this->options['decimal'], $this->options['separator']);
if (!empty($this->options['format_plural'])) {
  $value = PluralTranslatableMarkup::createFromTranslatedString($value, $this->options['format_plural_string']);
}

If we have already a separator set in the views field, like a comma (kind of normal in US when showing a number like 1234,56 as 1,234.56), the count passed later on in the locale_get_plural() is causing a warning that a "A non-numeric value encountered" at

// This is in line 256 of locale module right now.
$index = $count > 199 ? 100 + ($count % 100) : $count;

As far as I could find, this is a PHP8 warning of string comparison. I did not test it in earlier versions as anyway, I think D11 does not support it.

This is actually a continuation of #1515834 which was trying to address this in D7.

Steps to reproduce

* Install standard Drupal. Enable Views UI, Language, Interface translation.
* Add a second language and let translations import. That imports a plural format.
* Now this, is the recreation issue. We need to create nodes and files so that the file usage reaches a number > 1999 (2 to 9 as the first digit). A nice hack/workaround is to simply do an SQL query INSERT INTO file_usage (fid, module, type, id, count) VALUES (1, 'file', 'node', 1, 2345);
* Go to the [langcode(not necessary)]/admin/content/files.

Go to the recent log messages and see the warning.

Issue fork drupal-3620921

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

dimilias created an issue. See original summary.

dimilias’s picture

Assigned: dimilias » Unassigned
Status: Active » Needs review