php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76999 mb-regex-set-options return current options
Submitted: 2018-10-11 13:17 UTC Modified: 2020-03-13 14:56 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kay dot lukas at gmail dot com Assigned: cmb (profile)
Status: Closed Package: mbstring related
PHP Version: 7.1.22 OS: Mac OSX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 - 32 = ?
Subscribe to this entry?

 
 [2018-10-11 13:17 UTC] kay dot lukas at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.mb-regex-set-options
---

The documentation says that mb_regex_set_options should return the previous results, 

> The previous options. If options is omitted, it returns the string that describes the current options.


This is quite useful so you can change the options and easily set it back to the defaults after you are done with mb_regex. However, it seems to do something totally different, returning the current options instead.

It seems like the internal function is designed for it:

https://github.com/php/php-src/blob/a5e80b22e11c2db7fd5ff07b5b7a28f80745e89b/ext/mbstring/php_mbregex.c#L1624

however this functionality is not used in the wrapping function:

https://github.com/php/php-src/blob/a5e80b22e11c2db7fd5ff07b5b7a28f80745e89b/ext/mbstring/php_mbregex.c#L1660

null is passed in.

Test script:
---------------
```
php > var_dump(mb_regex_set_options("m"));
string(2) "mr"
php > var_dump(mb_regex_set_options("mdi"));
string(3) "imd"
php > var_dump(mb_regex_set_options("m"));
string(2) "mr"
php > var_dump(mb_regex_set_options("a"));
string(1) "r"
```


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-11 13:52 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: *Regular Expressions +Package: mbstring related
 [2018-10-11 13:52 UTC] cmb@php.net
Confirmed: <https://3v4l.org/5fiCT>.
 [2020-03-13 14:56 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #76999: mb-regex-set-options return current options
On GitHub:  https://github.com/php/php-src/pull/5264
Patch:      https://github.com/php/php-src/pull/5264.patch
 [2020-03-13 14:56 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-03-27 09:34 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9e77d5a9da9e80a1bfe226f60ccb12fd8bf9481c
Log: Fix #76999: mb_regex_set_options() return current options
 [2020-03-27 09:34 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2020-03-27 09:48 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349529
Log: Fix return values section

See bug #76999.
 [2020-03-27 12:14 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349531
Log: Fix return values section

See bug #76999.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC