php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45924 2 similar warning messages on mb_strpos and mb_stripos
Submitted: 2008-08-26 16:20 UTC Modified: 2008-08-28 13:17 UTC
From: d_kelsey at uk dot ibm dot com Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 5.2.6 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: d_kelsey at uk dot ibm dot com
New email:
PHP Version: OS:

 

 [2008-08-26 16:20 UTC] d_kelsey at uk dot ibm dot com
Description:
------------
2 warnings are generated when passed an unknown encoding, but one would suffice.The case sensitive versions only produce one.

Suggested code change in php_mb_stripos function

Move the following code to just below the "do {" line
		haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding);
		if (haystack.no_encoding == mbfl_no_encoding_invalid) {
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", from_encoding);
			break;
		}

Reproduce code:
---------------
<?php
var_dump(mb_strripos("abc abc abc", "b", 0, "invalid"));
var_dump(mb_stripos("abc abc abc", "b", 0, "invalid"));
?>

Expected result:
----------------
Warning: mb_strripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2
bool(false)

Warning: mb_stripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3
bool(false)


Actual result:
--------------
Warning: mb_strripos(): Illegal character encoding specified in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2

Warning: mb_strripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2
bool(false)

Warning: mb_stripos(): Illegal character encoding specified in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3

Warning: mb_stripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-28 13:22 UTC] d_kelsey at uk dot ibm dot com
my 5.2.6 install was pointing to 525 mbstring library. Problem has been fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC