Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/mbstring/mbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "mb_gpc.h"

#ifdef HAVE_MBREGEX
# include "zend_attributes.h"
# include "php_mbregex.h"
#endif

Expand Down
17 changes: 17 additions & 0 deletions ext/mbstring/mbstring.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @var string
* @cvalue php_mb_oniguruma_version
*/
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
const MB_ONIGURUMA_VERSION = UNKNOWN;
#endif

Expand Down Expand Up @@ -197,57 +198,73 @@ function mb_str_pad(string $string, int $length, string $pad_string = " ", int $

#ifdef HAVE_MBREGEX
/** @refcount 1 */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_regex_encoding(?string $encoding = null): string|bool {}

/** @param array $matches */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg(string $pattern, string $string, &$matches = null): bool {}

/** @param array $matches */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_eregi(string $pattern, string $string, &$matches = null): bool {}

/** @refcount 1 */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_replace(string $pattern, string $replacement, string $string, ?string $options = null): string|false|null {}

/** @refcount 1 */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_eregi_replace(string $pattern, string $replacement, string $string, ?string $options = null): string|false|null {}

/** @refcount 1 */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, ?string $options = null): string|false|null {}

/**
* @return array<int, string>|false
* @refcount 1
*/
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_split(string $pattern, string $string, int $limit = -1): array|false {}

#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_match(string $pattern, string $string, ?string $options = null): bool {}

#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search(?string $pattern = null, ?string $options = null): bool {}

/**
* @return array<int, int>|false
* @refcount 1
*/
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_pos(?string $pattern = null, ?string $options = null): array|false {}

/**
* @return array<int|string, string|false>|false
* @refcount 1
*/
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_regs(?string $pattern = null, ?string $options = null): array|false {}

#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_init(string $string, ?string $pattern = null, ?string $options = null): bool {}

/**
* @return array<int|string, string|false>|false
* @refcount 1
*/
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_getregs(): array|false {}

#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_getpos(): int {}

#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_ereg_search_setpos(int $offset): bool {}

/** @refcount 1 */
#[\Deprecated(since: '8.6', message: "Oniguruma functions support ends PHP 9.0")]
function mb_regex_set_options(?string $options = null): string {}
#endif
177 changes: 159 additions & 18 deletions ext/mbstring/mbstring_arginfo.h

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion ext/mbstring/tests/bug43994.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ try {

var_dump($mb_regs);
?>
--EXPECT--
--EXPECTF--
Without $regs arg:

Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
mb_ereg(): Argument #1 ($pattern) must not be empty
With $regs arg:

Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
mb_ereg(): Argument #1 ($pattern) must not be empty
NULL
9 changes: 8 additions & 1 deletion ext/mbstring/tests/bug69151.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ var_dump(NULL === mb_ereg_replace('.', "\\0", $str));
var_dump(false === mb_ereg_search_init("\x80", '.'));
var_dump(false === mb_ereg_search());
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_eregi() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)
bool(true)

Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)
3 changes: 2 additions & 1 deletion ext/mbstring/tests/bug72164.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ try {
}

?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
Option "e" is not supported
7 changes: 6 additions & 1 deletion ext/mbstring/tests/bug72399.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ try {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_eregi_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(0) ""

Deprecated: Function mb_ereg_search_pos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
No pattern was provided
3 changes: 2 additions & 1 deletion ext/mbstring/tests/bug72402.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ try {
} catch(Exception $e) {}
?>
DONE
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_replace_callback() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
DONE
27 changes: 26 additions & 1 deletion ext/mbstring/tests/bug72691.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,48 @@ mb_ereg_search('\Z');
var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search_getregs());
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(0)

Deprecated: Function mb_ereg_search_getregs() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
array(1) {
[0]=>
string(0) ""
}

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(0)

Deprecated: Function mb_ereg_search_getregs() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
array(1) {
[0]=>
string(0) ""
}

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)

Deprecated: Function mb_ereg_search_getregs() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
array(1) {
[0]=>
string(3) "foo"
}

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)

Deprecated: Function mb_ereg_search_getregs() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
array(1) {
[0]=>
string(0) ""
Expand Down
25 changes: 24 additions & 1 deletion ext/mbstring/tests/bug72693.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,41 @@ var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\Z'));
var_dump(mb_ereg_search_getpos());
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(0)

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(0)

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)

Deprecated: Function mb_ereg_search_getregs() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
array(1) {
[0]=>
string(3) "foo"
}

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)
11 changes: 10 additions & 1 deletion ext/mbstring/tests/bug72694.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ var_dump(mb_ereg_search_getpos());
var_dump(mb_ereg_search('\Z'));
var_dump(mb_ereg_search_getpos());
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_ereg_search_setpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)

Deprecated: Function mb_ereg_search() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(true)

Deprecated: Function mb_ereg_search_getpos() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
int(3)
2 changes: 2 additions & 0 deletions ext/mbstring/tests/bug72710.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
mb_ereg('(?<0>a)', 'a');
?>
--EXPECTF--
Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): mbregex compile err: invalid group name <0> in %s on line %d
3 changes: 2 additions & 1 deletion ext/mbstring/tests/bug73532.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
<?php
var_dump(mb_eregi("a", "\xf5"));
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_eregi() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(false)
2 changes: 2 additions & 0 deletions ext/mbstring/tests/bug73646.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
var_dump(mb_ereg_search_init(NULL));
?>
--EXPECTF--
Deprecated: Function mb_ereg_search_init() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: mb_ereg_search_init(): Passing null to parameter #1 ($string) of type string is deprecated in %s on line %d
bool(true)
13 changes: 12 additions & 1 deletion ext/mbstring/tests/bug76999.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,20 @@ try {
}
var_dump(mb_regex_set_options());
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(2) "pr"

Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(2) "mr"

Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(3) "imd"

Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
Option "a" is not supported

Deprecated: Function mb_regex_set_options() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(2) "mr"
5 changes: 4 additions & 1 deletion ext/mbstring/tests/bug77367.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ if (!function_exists('mb_split')) die('skip mb_split() not available');
mb_regex_encoding('UTF-8');
var_dump(mb_split("\\w", "\xfc"));
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_regex_encoding() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_split() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(false)
2 changes: 2 additions & 0 deletions ext/mbstring/tests/bug77370.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ if (!function_exists('mb_split')) die('skip mb_split() not available');
var_dump(mb_split(" \xfd",""));
?>
--EXPECTF--
Deprecated: Function mb_split() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line 2

Warning: mb_split(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
2 changes: 2 additions & 0 deletions ext/mbstring/tests/bug77371.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ if (!function_exists('mb_ereg')) die('skip mb_ereg() not available');
var_dump(mb_ereg("()0\xfc00000\xfc00000\xfc00000\xfc",""));
?>
--EXPECTF--
Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
8 changes: 8 additions & 0 deletions ext/mbstring/tests/bug77381.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ var_dump(mb_ereg("0000\\"."\xf5","0"));
var_dump(mb_ereg("(?i)FFF00000000000000000\xfd",""));
?>
--EXPECTF--
Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)

Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)

Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)

Deprecated: Function mb_ereg() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Warning: mb_ereg(): Pattern is not valid under UTF-8 encoding in %s on line %d
bool(false)
5 changes: 4 additions & 1 deletion ext/mbstring/tests/bug77418.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ mb_regex_encoding("UTF-32");

var_dump(mb_split("\x00\x00\x00\x5c\x00\x00\x00B","000000000000000000000000000000"));
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_regex_encoding() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d

Deprecated: Function mb_split() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(false)
9 changes: 6 additions & 3 deletions ext/mbstring/tests/bug77428.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ var_dump(mb_ereg_replace('(%)', '\\\1', 'a%c'));
var_dump(mb_ereg_replace('(%)', '\\\\1', 'a%c'));

?>
--EXPECT--
string(4) "a\%c"
string(4) "a\%c"
--EXPECTF--
Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(4) "a\%%c"

Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(4) "a\%%c"
3 changes: 2 additions & 1 deletion ext/mbstring/tests/bug77514.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ $a="abc123";
var_dump(mb_ereg_replace("123","def\\",$a));

?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_ereg_replace() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
string(7) "abcdef\"
3 changes: 2 additions & 1 deletion ext/mbstring/tests/bug78559.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ $str = "5b5b5b5b5b5b5b492a5bce946b5c4b5d5c6b5c4b5d5c4b5d1cceb04b5d1cceb07a73717e
$str = hex2bin($str);
var_dump(mb_eregi($str, $str));
?>
--EXPECT--
--EXPECTF--
Deprecated: Function mb_eregi() is deprecated since 8.6, Oniguruma functions support ends PHP 9.0 in %s on line %d
bool(false)
Loading
Loading