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
Mutator/mbstring #664
Mutator/mbstring #664
Conversation
I will have to test it a little bit longer so that this mutator will not produce mutats that will be killed by differences in mb string functions and std string functions. |
efe2da5
to
21f83cb
Compare
I have tested the mapping and removed functions that cannot be easily mapped:
|
final fixes added and doc PR created. I think this PR is polished enough to be merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very nice 👍
could you merge this PR ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mutator could be simplified if we add a workaround against missing constants to the test.
I'm sorry for going back and forth with this PR, but there isn't a test case for a mixed-case replacement as far as I can see, but please correct me if I overlook. E.g. a test case displaying that this replacement happens: - MB_Chr(74);
+ chr(74); This is customary for other mutators, an example. Other than that you're doing a beautiful work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR,
Only thing i'm missing is that a testcase function call with a variable name is not mutated. (And mostly that it doesn't crash)
e.g.
$a = 'mb_chr'
$a(74)
Should not mutate, and not crash.
Thank you @majkel89 👍 |
This PR:
Relates to issue #654
Converts function calls like
mb_chr(74, 'utf-8')
,mb_strlen('test', 'utf-8')
tochr('test')
,strlen('test')
.Supported functions:
Pay attention to the function mapping when doing code review.
mb_chr
->chr
mb_ord
->ord
mb_parse_str
->parse_str
mb_send_mail
->mail
mb_strcut
->substr
mb_stripos
->stripos
mb_stristr
->stristr
mb_strlen
->strlen
mb_strpos
->strpos
mb_strrchr
->strrchr
mb_strripos
->strripos
mb_strrpos
->strrpos
mb_strstr
->strstr
mb_strtolower
->strtolower
mb_strtoupper
->strtoupper
mb_substr_count
->substr_count
mb_substr
->substr
mb_convert_case
->strtolower
,strtoupper
,ucwords
depending on mode argumentNew profile
@extensions
created to hold this mutator. It is on by default.Configuration