Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote some warnings in MBString Regex #5341

Closed
wants to merge 7 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Apr 2, 2020

I'm clueless on some of them if they should be converted or not.

ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch from c9a14a3 to 2ad2671 Compare April 3, 2020 15:49
Comment on lines +15 to +24
try {
$var13 = mb_ereg_search_pos();
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECTF--
Warning: mb_ereg_search_pos(): No regex given in %sbug72399.php on line %d
--EXPECT--
bool(true)
string(0) ""
No pattern was provided
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't get why this throws, will need to investigate I suppose.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why shouldn't it throw?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know was confused, probably because I suppose it should throw before? As in in mb_ereg_search_init() ?

@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch 2 times, most recently from 7903ef5 to 54b6ac2 Compare April 9, 2020 22:18
@Girgias Girgias requested a review from nikic April 9, 2020 22:21
@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch from 54b6ac2 to 8092994 Compare April 10, 2020 16:13
@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch from 8092994 to 2aa6653 Compare April 23, 2020 21:47
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
@nikic
Copy link
Member

nikic commented Aug 6, 2020

I think another PR also did something in this area, can you please rebase?

ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch from 5d36f8a to fcd52e5 Compare September 8, 2020 13:46
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
ext/mbstring/php_mbregex.c Outdated Show resolved Hide resolved
Comment on lines +15 to +24
try {
$var13 = mb_ereg_search_pos();
} catch (\Error $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECTF--
Warning: mb_ereg_search_pos(): No regex given in %sbug72399.php on line %d
--EXPECT--
bool(true)
string(0) ""
No pattern was provided
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why shouldn't it throw?

@Girgias Girgias force-pushed the mbstring-regex-warnings-to-error branch from fcd52e5 to fdac9bd Compare September 8, 2020 15:36
@@ -651,14 +651,16 @@ _php_mb_regex_init_options(const char *parg, size_t narg, OnigOptionType *option
*syntax = ONIG_SYNTAX_POSIX_EXTENDED;
break;
case 'e':
if (eval != NULL) *eval = 1;
break;
zend_value_error("Option \"e\" is not supported");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this as a separate case (handle in default). Or alternatively, use a different error message like "no longer supported".

@php-pulls php-pulls closed this in 0444158 Sep 9, 2020
@Girgias Girgias deleted the mbstring-regex-warnings-to-error branch September 9, 2020 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants