Make WordPress Core

Opened 8 years ago

Last modified 5 months ago

#43668 new defect (bug)

Image cropping fails for many PHP locales, if set

Reported by: knutsp's profile knutsp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords: dev-feedback needs-patch
Focuses: javascript Cc:

Description

If{{{#!php
<?php
setlocale( LC_NUMERIC /*or LC_ALL */, 'nb_NO' );
}}}

is used then Media image cropping fails and selection input fields show Infinity. It works fine with 'en_US', btw.

If #17268 is implemented, I guess it includes use of `setlocale'.

Anyway, image cropping, and other internal passing of numeric data insede an application, should work independently of how numbers are to displayed according to a locale.

I don't know which file or script to look into, to suggest a patch. Any help appreciated.

Change History (4)

#1 @joemcgill
7 years ago

  • Keywords reporter-feedback added

Hi @knutsp,

I'm not able to reproduce this bug in WP 5.2-beta3. Can you confirm that this is still an issue, and if so, clarify the steps you used to reproduce this bug?

Thanks.

#2 @knutsp
7 years ago

  • Keywords dev-feedback added; reporter-feedback removed

The bug is still there in latest beta.

Install on PHP 7.3.3. Add ´setlocale´ to ´wp-config.php´ with a valid PHP locale string (important).

Using Firefox latest, upload an image to Media. Click "Edit Image" button. Drag the mouse pointer on the image to make a rectangle. Observe Selection field values being filled with Infinity.

Last edited 7 years ago by knutsp (previous) (diff)

#3 @marcelschulz
4 years ago

This bug still exists as of March 2022 (5.9.2).
We're setting another locale (setlocale(LC_ALL, 'de_DE.UTF-8');) which breaks image cropping in media library as described before.

Have you ever found a solution to it?

Last edited 4 years ago by marcelschulz (previous) (diff)

#4 @callumbw95
5 months ago

  • Keywords needs-patch added

Hi All,
I have taken a look into this, and applied the testing steps as mentioned previously within the latest version of WordPress, and it looks like this is functioning properly now. However I did notice that the thumbnail within the media library does not update after cropping the image whilst the locale is set to something other than the default. I have tested with the default locale and it works fine, so slightly different from the originally issue, and will need an extra patch to get this working 100%.
I will have a look into this and getting a patch ready in the next few days, but if anyone else want's to jump on this in the meantime feel free.

Note: See TracTickets for help on using tickets.