ouzo
ouzo copied to clipboard
`Strings` broken for multibytes
Commit https://github.com/letsdrink/ouzo/commit/017bbe6754528784bfed76adff50c8b5210e2d9a probably broke multi-byte safety, because this test now fails (test not in ouzo, I just wrote it)
/**
* @test
*/
public function shouldNotStartWithMalformedUnicode()
{
// given
$subject = '€';
$infix = \chr(226);
// when
$startsWith = Strings::startsWith($subject, $infix); // returns true
// then
$this->assertFalse($startsWith);
}
str_starts_with() is not mb-safe. Previous implementation would make this test pass. Maybe revert?