Bug #74170 [Opn->Csd]: locale information change after mime_content_type
| From: | nikic@php.net | Date: | Fri, 20 Dec 2019 10:24:33 +0000 |
| Subject: | Bug #74170 [Opn->Csd]: locale information change after mime_content_type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224438@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74170&edit=1
ID: 74170
Updated by: nikic@php.net
Reported by: viney91 at hotmail dot com
Summary: locale information change after mime_content_type
-Status: Open
+Status: Closed
Type: Bug
Package: *Languages/Translation
Operating System: linux
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of turchanov@farpost.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c62cd9a43ad97aa279615b21f7cb5f1646f52d80
Log: Fix #74170: locale information change after mime_content_type
Previous Comments:
------------------------------------------------------------------------
[2019-08-29 11:58:52] turchanov at farpost dot com
The following pull request has been associated:
Patch Name: Fix #74170: locale information change after mime_content_type
On GitHub: https://github.com/php/php-src/pull/4645
Patch: https://github.com/php/php-src/pull/4645.patch
------------------------------------------------------------------------
[2017-02-26 11:21:19] viney91 at hotmail dot com
Description:
------------
after mime_content_type function, the locale information is set with the file asked by
mime_content_type. Whe need to reset by setlocale() to retrieve the locale information what was
before calling mime_content_type().
NB: same issue with finfo_file()
Test script:
---------------
setlocale(LC_ALL, 'fr_FR.UTF-8');
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : beta (OK)
//
$mime=mime_content_type('sheet.xls'); // sheet.xls is not a UTF8 file.
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : b?t? (wrong)
//
$mime=mime_content_type('sheet.xls'); // sheet.xls is not a UTF8 file.
setlocale(LC_ALL, 'fr_FR.UTF-8');
echo iconv("UTF-8", 'ASCII//TRANSLIT//IGNORE', 'bétâ'); //
output : beta (OK)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74170&edit=1