summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-07-11 17:02:04 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-07-22 11:39:52 +0200
commit39e756e7fe7b08092b4a75cf253442cba826e910 (patch)
tree84fee235bf751e878aac42bc20890938c9bde8ad
parent3121b7174f4cb077b1165bf4feed1ec889472f1e (diff)
downloadphp-git-39e756e7fe7b08092b4a75cf253442cba826e910.tar.gz
Deprecate encoding as 3rd param to mb_strrpos()
-rw-r--r--ext/mbstring/mbstring.c3
-rw-r--r--ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt3
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation5.phpt14
3 files changed, 18 insertions, 2 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 057f192c9f..463b01c87d 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -2600,6 +2600,9 @@ PHP_FUNCTION(mb_strrpos)
break;
default :
enc_name = Z_STR_P(zoffset);
+ php_error_docref(NULL, E_DEPRECATED,
+ "Passing the encoding as third parameter is deprecated. "
+ "Use an explicit zero offset");
break;
}
} else {
diff --git a/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt b/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt
index a8ef339a0d..66ccd00908 100644
--- a/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt
+++ b/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt
@@ -9,5 +9,6 @@ mb_internal_encoding('UTF-16');
var_dump(mb_strrpos("abc abc abc", "abc", "UTF-8"));
?>
---EXPECT--
+--EXPECTF--
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(8)
diff --git a/ext/mbstring/tests/mb_strrpos_variation5.phpt b/ext/mbstring/tests/mb_strrpos_variation5.phpt
index 4eb8c1f9be..6b7b75ecd9 100644
--- a/ext/mbstring/tests/mb_strrpos_variation5.phpt
+++ b/ext/mbstring/tests/mb_strrpos_variation5.phpt
@@ -38,24 +38,36 @@ foreach ($inputs as $type => $input) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing mb_strrpos() : usage variations ***
-- Double Quoted String --
-- With fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
-- Without fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
-- Single Quoted String --
-- With fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
-- Without fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
-- Heredoc --
-- With fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
-- Without fourth encoding argument --
+
+Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
int(20)
Done