Skip to content

Commit c559f22

Browse files
committed
Merge branch 'master' into preload
* master: Stop Apache if PHP wasn't started successful. Execute zend_post_startup() with module_initialized flag set. Removed dead code Fix mb_strrpos() with encoding passed as 3rd param
2 parents 310631c + ea2e678 commit c559f22

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

ext/mbstring/mbstring.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,12 +2399,6 @@ PHP_FUNCTION(mb_strrpos)
23992399
return;
24002400
}
24012401

2402-
haystack.no_language = needle.no_language = MBSTRG(language);
2403-
haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name);
2404-
if (!haystack.encoding) {
2405-
RETURN_FALSE;
2406-
}
2407-
24082402
if (zoffset) {
24092403
if (Z_TYPE_P(zoffset) == IS_STRING) {
24102404
enc_name2 = Z_STRVAL_P(zoffset);
@@ -2446,6 +2440,12 @@ PHP_FUNCTION(mb_strrpos)
24462440
}
24472441
}
24482442

2443+
haystack.no_language = needle.no_language = MBSTRG(language);
2444+
haystack.encoding = needle.encoding = php_mb_get_encoding(enc_name);
2445+
if (!haystack.encoding) {
2446+
RETURN_FALSE;
2447+
}
2448+
24492449
if (offset != 0) {
24502450
size_t haystack_char_len = mbfl_strlen(&haystack);
24512451
if ((offset > 0 && offset > haystack_char_len) ||
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Passing encoding as 3rd param to mb_strrpos (legacy)
3+
--FILE--
4+
<?php
5+
6+
mb_internal_encoding('UTF-16');
7+
var_dump(mb_strrpos("abc abc abc", "abc", "UTF-8"));
8+
9+
?>
10+
--EXPECT--
11+
int(8)

0 commit comments

Comments
 (0)