php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55817 Wrong codes of mb_detect_encoding
Submitted: 2011-09-30 07:40 UTC Modified: 2011-10-04 13:55 UTC
From: laruence@php.net Assigned: laruence (profile)
Status: Closed Package: mbstring related
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2011-09-30 07:40 UTC] laruence@php.net
Description:
------------
using Z_STRVAL_P before make sure it is IS_STRING:

see http://lxr.php.net/opengrok/xref/PHP_5_4/ext/mbstring/mbstring.c#3186

if (ZEND_NUM_ARGS() >= 2 && Z_STRVAL_P(encoding_list)) {
  		switch (Z_TYPE_P(encoding_list)) {
  		case IS_ARRAY:
  			if (FAILURE == 
php_mb_parse_encoding_array(encoding_list, &list, &size, 0 TSRMLS_CC)) {
  				if (list) {
  					efree(list);
  					list = NULL;
  					size = 0;
  				}
  			}
  			break;
  		default:
  			convert_to_string(encoding_list);
  			if (FAILURE == 
php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), 
&list, &size, 0 TSRMLS_CC)) {
  				if (list) {
  					efree(list);
  					list = NULL;
  					size = 0;
  				}
  			}
  			break;
  		}
  		if (size <= 0) {
  			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal 
argument");
  		}
  	}

Test script:
---------------
none

Expected result:
----------------
none

Actual result:
--------------
none

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-30 07:43 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2011-09-30 13:33 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=317493
Log: Fix wrong codes #55817
 [2011-09-30 15:08 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=317524
Log: A better fix for #55817 (thanks to bjori)
 [2011-10-04 13:55 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2011-10-04 13:55 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC