php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74170 locale information change after mime_content_type
Submitted: 2017-02-26 11:21 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: viney91 at hotmail dot com Assigned:
Status: Open Package: *Languages/Translation
PHP Version: 5.6.30 OS: linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-02-26 11:21 UTC] 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)



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-08-29 11:58 UTC] 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
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 16 02:01:26 2019 UTC