Bug #76999 [NEW]: mb-regex-set-options return current options
From: kay dot lukas at gmail dot com
Operating system: Mac OSX
PHP version: 7.1.22
Package: *Regular Expressions
Bug Type: Bug
Bug description:mb-regex-set-options return current options
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"
```
--
Edit bug report at https://bugs.php.net/bug.php?id=76999&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76999&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76999&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76999&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76999&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76999&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76999&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76999&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76999&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76999&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76999&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76999&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76999&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76999&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76999&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76999&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76999&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76999&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76999&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76999&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76999&r=mysqlcfg
Thread (4 messages)
- kay dot lukas at gmail dot com