Skip to content

Commit

Permalink
close #95
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 5, 2025
1 parent b692930 commit dbd241e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/Processors/StringProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ final class StringProcessor implements ProcessorInterface
{
use ProcessorTrait;

public const CONTROL_CHARS = [
"\t" => '\t',
"\n" => '\n',
"\v" => '\v',
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
];

public const CONTROL_CHARS_RX = '/[\x00-\x1F\x7F]+/';

private string $charset = '';

private string $string = '';
Expand Down Expand Up @@ -82,10 +93,34 @@ private function handleBinaryString(): void
return; // @codeCoverageIgnore
}
$this->string = <<<STRING
b"{$this->utf8Encode($this->string)}"
b"{$this->binaryDisplay($this->utf8Encode($this->string))}"
STRING;
}

private function binaryDisplay(string $value): string
{
$map = static::CONTROL_CHARS;
$startChar = '';
$endChar = '';
$value = preg_replace_callback(
static::CONTROL_CHARS_RX,
function ($c) use ($map, $startChar, $endChar) {
$s = $startChar;
$c = $c[$i = 0];
do {

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';

Check warning on line 110 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "DoWhile": @@ @@ $c = $c[$i = 0]; do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); - } while (isset($c[++$i])); + } while (false); return $s . $endChar; }, $value, -1, $charCount); return $value ?? '';
$s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i]));

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Coalesce": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s .= sprintf('\x%02X', ord($c[$i])) ?? $map[$c[$i]]; } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);

Check warning on line 111 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Assignment": @@ @@ $s = $startChar; $c = $c[$i = 0]; do { - $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); + $s = $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; }, $value, -1, $charCount);
} while (isset($c[++$i]));

return $s . $endChar;

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "Concat": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $endChar . $s; }, $value, -1, $charCount); return $value ?? ''; }

Check warning on line 114 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "ConcatOperandRemoval": @@ @@ do { $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); - return $s . $endChar; + return $s; }, $value, -1, $charCount); return $value ?? ''; }
},
$value,
-1,

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**

Check warning on line 117 in src/Processors/StringProcessor.php

View workflow job for this annotation

GitHub Actions / PHP 8.4 test on ubuntu-24.04

Escaped Mutant for Mutator "DecrementInteger": @@ @@ $s .= $map[$c[$i]] ?? sprintf('\x%02X', ord($c[$i])); } while (isset($c[++$i])); return $s . $endChar; - }, $value, -1, $charCount); + }, $value, -2, $charCount); return $value ?? ''; } /**
$charCount
);

return $value ?? '';
}

/**
* Converts a non-UTF-8 string to UTF-8.
*/
Expand Down
1 change: 1 addition & 0 deletions tests/Processors/StringProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function dataProviderConstruct(): array
['😀'],
[''],
[chr(128), 'b"€"'],
[hex2bin('ae0f3d'), 'b"®\x0F="'],
];
}

Expand Down

0 comments on commit dbd241e

Please sign in to comment.