php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68842 mb_check_encoding() behavior does not check all HTTP inputs
Submitted: 2015-01-16 02:36 UTC Modified: 2017-10-24 03:07 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: yohgaki@php.net Assigned: yohgaki (profile)
Status: Assigned Package: mbstring related
PHP Version: Irrelevant OS: Irerelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-01-16 02:36 UTC] yohgaki@php.net
Description:
------------
http://php.net/mb_check_encoding

says,

var
The byte stream to check. If it is omitted, this function checks all the input from the beginning of the request.

This description is misleading. What mbstring does is 

Return TRUE if all conversions since the execution of the script has no problems at all. Return FALSE if there is any conversion errors in mbstring operations.

If input encoding conversion is done, all inputs (GPC) are converted from mbstring.http_input encoding to mbstring.internal_encoding. If input encoding conversion is not done, it cannot be used for input encoding checks.

I think it's better to check GET/POST/COOKIE encodings, but it was made this way since the introduction, I guess. (I think 1st param was not optional at first, but I don't remember well.)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-25 02:34 UTC] yohgaki@php.net
-Assigned To: +Assigned To: yohgaki
 [2015-12-18 10:02 UTC] yohgaki@php.net
Automatic comment from SVN on behalf of yohgaki
Revision: http://svn.php.net/viewvc/?view=revision&revision=338292
Log: Fix bug #68842 mb_check_encoding() behavior does not match document
 [2015-12-18 10:02 UTC] yohgaki@php.net
-Status: Assigned +Status: Closed
 [2015-12-19 23:23 UTC] yohgaki@php.net
-Summary: mb_check_encoding() behavior does not match document +Summary: mb_check_encoding() behavior does not check all HTTP inputs -Status: Closed +Status: Re-Opened -Type: Documentation Problem +Type: Bug
 [2015-12-19 23:23 UTC] yohgaki@php.net
Rather than change old doc. It's better to change mb_check_encoding() behavior to documented way.
 [2017-10-24 03:07 UTC] kalle@php.net
-Status: Re-Opened +Status: Assigned
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC