GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing phabricator.wikimedia.org — T181987 Thumbnails are broken (False decimal point in srcset when locale is not English)
Assigned To None Authored By
Referenced Files None
Description Since update to MediaWiki 1.30 there is a problem with decimal point in the values of a srcset for images. expected: srcset="URL1 1.5x, URL2 2x" [.] The image display fails. For now I disabled the Responsiv Images. But I don't know where else this problem occurs. Locale is set to: mediawiki 1.29 and now 1.30rc
Related Objects
Event TimelineRestricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 4 2017, 12:58 PM2017-12-04 12:58:36 (UTC+0) Aklapper added projects: [DO NOT USE] NewPHP, MediaWiki-General.Dec 4 2017, 1:12 PM2017-12-04 13:12:51 (UTC+0) Comment ActionsThanks for reporting this! Reedy moved this task from Unsorted to PHP 7.2 on the [DO NOT USE] NewPHP board.Dec 4 2017, 1:15 PM2017-12-04 13:15:19 (UTC+0) Comment Actions That looks like something is applying european style number formatting (. swapped for ,) Comment Actions static function srcSet( array $urls ) { $candidates = []; foreach ( $urls as $density => $url ) { // Cast density to float to strip 'x', then back to string to serve // as array index. $density = (string)(float)$density; $candidates[$density] = $url; } // Remove duplicates that are the same as a smaller value ksort( $candidates, SORT_NUMERIC ); $candidates = array_unique( $candidates ); // Append density info to the url foreach ( $candidates as $density => $url ) { $candidates[$density] = $url . ' ' . $density . 'x'; } return implode( ", ", $candidates ); } Does casting to a float if local is de cause this problem? Reedy edited projects, added: MediaWiki-Internationalization, I18n; removed: MediaWiki-General.Dec 4 2017, 7:34 PM2017-12-04 19:34:08 (UTC+0) Seb35 subscribed. Comment Actions
I just opened an other but related issue T184458 with floats being truncated to their integer part in SQL when locale is not English. Setting setlocale(LC_NUMERIC, "C") would solve both issues, but it will probably have side-effects elsewhere. This is probably a common issue in PHP world, perhaps other projects have fixed it in a nice manner. PS: this is not related to PHP 7.2, it can be reproduced with older PHP versions. Seb35 renamed this task from False decimal point in srcset #php7.2 to False decimal point in srcset when locale is not English.Jan 8 2018, 5:07 PM2018-01-08 17:07:24 (UTC+0) Comment Actions From a comment in https://www.mediawiki.org/wiki/Topic:U7h4x03lzgbzd2qd#flow-post-uhgx58vkowl5xsoh: Setting setlocale(LC_NUMERIC, "C"); alone doesn't solve the problem (or not always?, I dunno). The user had to comment out/unset $wgShellLocale for this to work. Maybe MediaWiki does another setlocale with $wgShellLocale during setup, overriding any previous setlocale in LocalSettings.php. Comment Actions Our wiki (Marjorie-Wiki) is using (nearly) the same templates as de.wikipedia.org. After updating from 1.28.3 to 1.30.0 our thumbnails were broken. <span class="geo microformat"><span class="body"></span><span class="latitude">48,46471</span><span class="longitude">8,6613</span><span class="elevation"></span></span><span id="coordinates" class="coordinates plainlinks-print"><span title="Koordinatensystem WGS84">… (note the commas instead of colons) First quick solution was $wgResponsiveImages=false, which brought the thumbnails back. Setting However setting Comment Actions As this task has many duplicates I'm boldly adding Platform Engineering and ask for feedback (though wondering if this could also be Language related)? • mobrovac moved this task from Inbox to Triage Meeting Inbox on the Platform Engineering board.Aug 9 2019, 10:27 AM2019-08-09 10:27:14 (UTC+0) • WDoranWMF edited projects, added: Platform Team Workboards (Clinic Duty Team); removed: Platform Engineering. Comment Actions
At Setup.php line 141, the setting of LC_ALL overrides the LC_NUMERIC. I wonder whether there would be any drawback to MediaWiki doing setlocale( LC_NUMERIC, 'C' ) just after that line unconditionally. • mobrovac moved this task from Inbox to Discussing on the Platform Team Workboards (Clinic Duty Team) board.Aug 14 2019, 10:54 AM2019-08-14 10:54:33 (UTC+0) • mobrovac subscribed. Comment Actions
Wouldn't that mess with the way decimal points are displayed then? Comment Actions It would mess with the way decimal points are displayed when PHP code casts a float to a string, as in the cases being complained about by this bug. It shouldn't affect code that is using Language::formatNum(), which is what anything in MediaWiki actually displaying decimal points for humans to read should be using. More specifically, it shouldn't affect anything on Wikimedia wikis because those all already use C.UTF-8, and as far as I know C versus C.UTF-8 doesn't make a difference for LC_NUMERIC. • Chealer renamed this task from False decimal point in srcset when locale is not English to Thumbnails are broken (False decimal point in srcset when locale is not English).Dec 2 2019, 2:45 AM2019-12-02 02:45:55 (UTC+0) Comment Actions Today a user on IRC came with a similar problem on 1.34, but this time an exception when saving an edit, where a timestamp was being represented with a comma instead of a dot: T241533 The solution was to set $wgShellLocale = "C.UTF-8"; the same as this problem. Resolving the core issue will result both problems • AMooney moved this task from Discussing to Teleport on the Platform Team Workboards (Clinic Duty Team) board.Mar 24 2020, 6:52 PM2020-03-24 18:52:19 (UTC+0) • WDoranWMF edited projects, added: Platform Engineering (Icebox); removed: Platform Team Workboards (Clinic Duty Team).Mar 24 2020, 9:48 PM2020-03-24 21:48:17 (UTC+0) Comment Actions For the current 1.35 we experienced the same problem as in the original description above. At the same time, we have a very similar locale-related issue with Cirrussearch which should have been solved already (T189877). Tgr subscribed. Comment Actions
Not casting to a float per se, but casting back to a string. It would be best to simply strip non-alphabetic characters, as done in the following commit: https://github.com/wikimedia/mediawiki/pull/152/commits/01596cdc19c660a7f26d30098e057b9946c5db45 • Chealer changed the subtype of this task from "Task" to "Bug Report".Jul 8 2025, 5:30 PM2025-07-08 17:30:02 (UTC+0) Comment ActionsThe problematic code has moved to includes/Html/Html.php. The function code still looks incorrect, but I must say I am not sure this still affects MediaWiki 1.39.13, given that:
Thank you for reporting All comments and attachments which I added to this ticket are offered under the terms of CC0 1.0. So is the fix I linked to. Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct. · Wikimedia Foundation · Privacy Policy · Code of Conduct · Terms of Use · Disclaimer · CC-BY-SA · GPL · Credits | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |