Skip to content

Commit 39e756e

Browse files
committed
Deprecate encoding as 3rd param to mb_strrpos()
1 parent 3121b71 commit 39e756e

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

ext/mbstring/mbstring.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,6 +2600,9 @@ PHP_FUNCTION(mb_strrpos)
26002600
break;
26012601
default :
26022602
enc_name = Z_STR_P(zoffset);
2603+
php_error_docref(NULL, E_DEPRECATED,
2604+
"Passing the encoding as third parameter is deprecated. "
2605+
"Use an explicit zero offset");
26032606
break;
26042607
}
26052608
} else {

ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ mb_internal_encoding('UTF-16');
99
var_dump(mb_strrpos("abc abc abc", "abc", "UTF-8"));
1010

1111
?>
12-
--EXPECT--
12+
--EXPECTF--
13+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
1314
int(8)

ext/mbstring/tests/mb_strrpos_variation5.phpt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,36 @@ foreach ($inputs as $type => $input) {
3838

3939
echo "Done";
4040
?>
41-
--EXPECT--
41+
--EXPECTF--
4242
*** Testing mb_strrpos() : usage variations ***
4343

4444
-- Double Quoted String --
4545
-- With fourth encoding argument --
46+
47+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
4648
int(20)
4749
-- Without fourth encoding argument --
50+
51+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
4852
int(20)
4953

5054
-- Single Quoted String --
5155
-- With fourth encoding argument --
56+
57+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
5258
int(20)
5359
-- Without fourth encoding argument --
60+
61+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
5462
int(20)
5563

5664
-- Heredoc --
5765
-- With fourth encoding argument --
66+
67+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
5868
int(20)
5969
-- Without fourth encoding argument --
70+
71+
Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
6072
int(20)
6173
Done

0 commit comments

Comments
 (0)