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: Closed Package: *Languages/Translation
PHP Version: 5.6.30 OS: linux
Private report: No CVE-ID: None
 [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

Pull Requests

Pull requests:

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
 [2019-12-20 10:24 UTC] nikic@php.net
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
 [2019-12-20 10:24 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 15:01:29 2024 UTC