diff --git a/src/guide/mutators.md b/src/guide/mutators.md index 774e0acc..2318ba97 100644 --- a/src/guide/mutators.md +++ b/src/guide/mutators.md @@ -292,7 +292,54 @@ infection.json: | CastString | `(string) $value;` | `$value` | ### Regex + | Name | Original | Mutated | | :------: | :------: |:-------:| | PregQuote | `$a = preg_quote('text');` | `$a = 'text';` | | PregMatchMatches | `preg_match('/pattern/', $value, $matches);` | `(int) $matches = array();` | + +### Extensions + +| Name | Original | Mutated | +| :------: | :------: |:-------:| +| MBString | `mb_chr($code);` | `chr($code);` | +| | `mb_ord($character);` | `ord($character);` | +| | `mb_parse_str('text', $results);` | `parse_str('text', $results);` | +| | `mb_send_mail($to, $subject, $message, $headers, $parameters);` | `mail($to, $subject, $message, $headers, $parameters);` | +| | `mb_strcut('text', 0, 123, 'utf-8');` | `substr('text', 0, 123);` | +| | `mb_stripos('text', 't', 0, 'utf-8');` | `stripos('text', 't', 0);` | +| | `mb_stristr('text', 't', true, 'utf-8');` | `stristr('text', 't', true);` | +| | `mb_strlen('text', 'utf-8');` | `strlen('text');` | +| | `mb_strpos('text', 't', 0, 'utf-8');` | `strpos('text', 't', 0);` | +| | `mb_strrchr('text', 't', true, 'utf-8');` | `strrchr('text', 't', true);` | +| | `mb_strripos('text', 't', 0, 'utf-8');` | `strripos('text', 't', 0);` | +| | `mb_strrpos('text', 't', 0, 'utf-8');` | `strrpos('text', 't', 0);` | +| | `mb_strstr('text', 't', true, 'utf-8');` | `strstr('text', 't', true);` | +| | `mb_strtolower('text', 'utf-8');` | `strtolower('text');` | +| | `mb_strtoupper('text', 'utf-8');` | `strtoupper('text');` | +| | `mb_substr_count('text', 't', 'utf-8');` | `substr_count('text', 't');` | +| | `mb_substr('text', 0, 123, 'utf-8');` | `substr('text', 0, 123);` | +| | `mb_convert_case('text', $mode);` | `strtoupper('text');`, `strtolower('text');` or `ucwords('text');` depending on mode | + +#### `MBString` + + * `"mb_parse_str": true`: You are able to disable any of the supported mb string functions. All supported functions are enabled by default. + +> Some of the functions are not supported due to complexity to convert them to standard string manipulation functions. +> Implementing them either does not make sense or creates too many false positive mutations. +> Not supported functions are `mb_ereg*`, `mb_split`, `mb_strrichr`, `mb_get_info` and similar. + +infection.json: + +```json +{ + "mutators": { + "MBString": { + "settings": { + "mb_send_mail": false, + "mb_substr_count": false + } + } + } +} +``` diff --git a/src/guide/profiles.md b/src/guide/profiles.md index 8ab0fa59..2f631224 100644 --- a/src/guide/profiles.md +++ b/src/guide/profiles.md @@ -247,6 +247,12 @@ Contains the following mutators: * [Foreach_](/guide/mutators.html#Loop) * [For_](/guide/mutators.html#Loop) +### `@extensions` + +Contains the following mutators: + + * [MBString](/guide/mutators.html#Extensions) + ### `@default` This is the default profile, which currently contains **most** mutators, and is used if no mutator or profile is chosen.