# RFC: Oniguruma maintenance end and end of mbregex

- Status: Implemented (PHP 8.6)
- Authors: Yuya Hamada youkidearitai@gmail.com
- Date: 2025-08-21
- Version: 0.1
- Implementation: https://github.com/php/php-src/pull/21490
- Original: https://wiki.php.net/rfc/eol-oniguruma
- Page: https://externals.io/rfc/eol-oniguruma
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

## Votes

### Drop support the mbregex functions, Deprecate 8.6 and delete 9.0 (closed)

Yes: 24 · No: 0 · Abstain: 0

Voters: ashnazg (Yes), brzuchal (Yes), crell (Yes), cschneid (Yes), derick (Yes), galvao (Yes), geekcom (Yes), girgias (Yes), iliaa (Yes), ilutov (Yes), kalle (Yes), kguest (Yes), klaussilveira (Yes), marandall (Yes), mbeccati (Yes), nicolasgrekas (Yes), nielsdos (Yes), ocramius (Yes), pajoye (Yes), petk (Yes), ramsey (Yes), shivam (Yes), thorstenr (Yes), timwolla (Yes)

## Discussions on the mailing list

- [Oniguruma maintenance was ended on 2025-04-24](https://externals.io/message/127245.md) — started on 2025-04-30, 15 messages
- [\[DISCUSSION\] Deprecate mbregex in PHP 8.6 and maintenance version](https://externals.io/message/128522.md) — started on 2025-08-22, 9 messages
- [\[RFC\]\[UNDER DISCUSSION\] Oniguruma maintenance end and future of mbregex(End of mbregex)](https://externals.io/message/130415.md) — started on 2026-03-23, 9 messages
- [\[VOTE\] Oniguruma maintenance end and end of mbregex](https://externals.io/message/130598.md) — started on 2026-04-10, 4 messages

---

## Introduction

[Oniguruma](https://github.com/kkos/oniguruma) maintenance ended on 2025-04-24. PHP uses mbregex (mb\_ereg...) functions. So we decide future of mbregex. This proposal is to end support for mbregex in PHP 9.0 and deprecate in 8.6.

## Proposal

Deprecate mbregex functions in PHP 8.6, remove in 9.0.

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

It is likely that the following points need to be decided, and how we will maintain versions 8.2 - 8.5.

- Maintenance versions: 8.2, 8.3, 8.4, 8.5 
    - Mbregex instead of mb\_onig
- Deprecate version: 8.6 (next after 8.5)
- Drop support: 9.0

Maintenance versions can use mbregex functions. However, FreeBSD will drop support on 2026-12-01 (ref: <https://github.com/php/php-src/issues/18467#issuecomment-3044192511>). We should decide what we will do after EOL in FreeBSD. (This affects CI in the php-src repository)

I suggest:

- External packaging, for example [https://github.com/youkidearitai/mb\_onig/](https://github.com/youkidearitai/mb_onig/) (created by me)
- Disable mbregex in configure option (--disable-mbregex)

## Drop the following mbregex functions

- mb\_ereg
- mb\_ereg\_match
- mb\_ereg\_replace
- mb\_ereg\_replace\_callback
- mb\_ereg\_search
- mb\_ereg\_search\_getpos
- mb\_ereg\_search\_getregs
- mb\_ereg\_search\_init
- mb\_ereg\_search\_pos
- mb\_ereg\_search\_regs
- mb\_ereg\_search\_setpos
- mb\_eregi
- mb\_eregi\_replace
- mb\_regex\_encoding
- mb\_regex\_set\_options
- mb\_split

### Constants

- MB\_ONIGURUMA\_VERSION

### php.ini options

- mbstring.regex\_retry\_limit
- mbstring.regex\_stack\_limit

## Forked from Oniguruma

In Ruby, There is a [Onigmo](https://github.com/k-takata/Onigmo) forked from Oniguruma.

However, Onigmo is different than Oniguruma.

- Performance (faster than Oniguruma)
- Unicode version
- Some expressions: &#96;\\K&#96;, &#96;\\R&#96;, &#96;(?(cond)yes\|no)&#96; 
    - Source: <https://github.com/k-takata/Onigmo/blob/master/README>

## Libraries that depend on Oniguruma (estimated)

I quoted from <https://news-web.php.net/php.internals/130429>

Uses code from Juliette: <https://gist.github.com/jrfnl/bd0f66f1c185930427db4f093babf214>

```
Summary of findings:

PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
-------------------------------------------------------------------------------------------
SOURCE COUNT
-------------------------------------------------------------------------------------------
PHPCompatibility.FunctionUse.RemovedFunctions.mb_splitDeprecated 30
PHPCompatibility.FunctionUse.RemovedFunctions.mb_regex_encodingDeprecated 25
PHPCompatibility.FunctionUse.RemovedFunctions.mb_eregi_replaceDeprecated 20
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_replaceDeprecated 18
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_matchDeprecated 13
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_search_initDeprecated 10
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_search_regsDeprecated 9
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_replace_callbackDeprecated 6
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_search_getregsDeprecated 5
PHPCompatibility.FunctionUse.RemovedFunctions.mb_eregDeprecated 4
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_search_setposDeprecated 4
PHPCompatibility.FunctionUse.RemovedFunctions.mb_eregiDeprecated 2
PHPCompatibility.FunctionUse.RemovedFunctions.mb_ereg_search_posDeprecated 1
-------------------------------------------------------------------------------------------
A TOTAL OF 147 SNIFF VIOLATIONS WERE FOUND IN 13 SOURCES
-------------------------------------------------------------------------------------------
```

Thanks, Juliette.

However, proprietary software probably uses mbregex functions, so impact is larger than that result.

## External packaging for mb\_onig

This RFC has a big impact on multibyte (not UTF-8) users.

Therefore, I created bailout extension mb\_onig [https://packagist.org/packages/mb\_onig/mb\_onig](https://packagist.org/packages/mb_onig/mb_onig) so PHP 8.x can still use mbregex functions and we can still maintain mbregex for PHP 9.x.

#### Why the name is &#96;mb\_onig&#96;?

Debian/Ubuntu users call Oniguruma &#96;onig&#96;. I quoted this.

```
$ sudo apt search onig
libonig-dev/noble,now 6.9.9-1build1 amd64 [installed]
  regular expressions library — development files

libonig5/noble,now 6.9.9-1build1 amd64 [installed,automatic]
  regular expressions library
```

### PHP 8.x

```
./configure --enable-mbstring --disable-mbregex
make
make install
pie install mb_onig/mb_onig
```

### PHP 9

```
./configure --enable-mbstring
make
make install
pie install mb_onig/mb_onig
```

## Backward Incompatible Changes

The mbregex functions cannot be used.

## Proposed PHP Version(s)

Deprecate for 8.6 and remove in 9.0.

## RFC Impact

### To Existing Extensions

Mbregex

### To SAPIs

Describe the impact to CLI, Development web server, embedded PHP etc.

## Open Issues

<https://github.com/php/php-src/issues/18467>

## Future Scope

This section should outline areas that you are not planning to work on in the scope of this RFC, but that might be iterated upon in the future by yourself or another contributor.

This helps with long-term planning and ensuring this RFC does not prevent future work.

## Voting Choices

Primary Vote requiring a 2/3 majority to accept the RFC:

**Vote: Drop support the mbregex functions, Deprecate 8.6 and delete 9.0** — Yes: 24 · No: 0 · Abstain: 0 (closed)

## Implementation

- Re-include Oniguruma version: <https://github.com/php/php-src/pull/19258>
- mb\_onig: [https://github.com/youkidearitai/mb\_onig](https://github.com/youkidearitai/mb_onig)
    - Packagist: [https://packagist.org/packages/mb\_onig/mb\_onig](https://packagist.org/packages/mb_onig/mb_onig)
- Deprecate mbregex: <https://github.com/php/php-src/pull/21490>

## References

- [Mailing list when mbregex was changed to Oniguruma (Japanese mailing list ml.php.gr.jp)](http://ml.php.gr.jp/pipermail/php-dev/2003-August/000844.html)
- <https://externals.io/message/127245#127245>

## Rejected Features

Keep this updated with features that were discussed on the mail lists.

## Changelog

If there are major changes to the initial proposal, please include a short summary with a date or a link to the mailing list announcement here, as not everyone has access to the wikis' version history.
