php / php/doc-en

mb_regex_set_options never had eval option?

Open
#2,103 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extension: mbstring
Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

  • PHP 7.1: Eval option deprecated in mb_ereg_replace and mb_eregi_replace (RFC).
  • PHP 8.0: Eval option removed, but also throws a ValueError with mb_regex_set_options (not documented, AFAIK).

However, when trying to set e using mb_regex_set_options in versions where it was still allegedly supported, it seems to have no effect.

// In PHP 5.0 through 7.4, this returns ixplnr, without e
var_dump(mb_regex_set_options('ixplner')); 
// this does not have the eval effect
var_dump(mb_ereg_replace('(h)', 'strtoupper("\\1")', 'hello', null)); 

Result in all versions: https://3v4l.org/pXd41G

Was eval ever a thing with mb_regex_set_options? Should I update the docs to reflect reality, or am I missing something?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked RFC and the 3v4l.org reproduction, then compare the documented behavior of mb_regex_set_options and mb_ereg_replace. Confirm whether the eval option was ever supported and document the verified behavior or correction once the discrepancy is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.