Table of Contents

PHP RFC: Oniguruma maintenance end and end of mbregex

Introduction

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 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:

Drop the following mbregex functions

Constants

php.ini options

Forked from Oniguruma

In Ruby, There is a Onigmo forked from Oniguruma.

However, Onigmo is different than Oniguruma.

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 so PHP 8.x can still use mbregex functions and we can still maintain mbregex for PHP 9.x.

Why the name is `mb_onig`?

Debian/Ubuntu users call Oniguruma `onig`. 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:

Drop support the mbregex functions, Deprecate 8.6 and delete 9.0
Real name Yes No Abstain
ashnazg   
brzuchal   
crell   
cschneid   
derick   
girgias   
iliaa   
ilutov   
kalle   
kguest   
marandall   
mbeccati   
nicolasgrekas   
nielsdos   
ocramius   
pajoye   
petk   
ramsey   
shivam   
thorstenr   
timwolla   
Count: 21 0 0
This poll will close on 2026-04-25 00:00:00 UTC.

Implementation

References

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.