Skip to content

Conversation

@artengin
Copy link
Contributor

refs: #57838
Added support for multibyte strings in substrReplace. The problem was that PHP's substr_replace does not handle multibyte characters correctly.

@vadimonus
Copy link
Contributor

vadimonus commented Nov 21, 2025

@artengin , does you implementation have any profits over one-liner from https://www.php.net/manual/ru/ref.mbstring.php#121807 ?

You have condition for negative offset, but your tests does not cover it. You may use negative offset example from #57838

Also, take a look, offset can be array of ints! Your code will fail with array, breaking backward compatibility. For reference, original tests with arrays https://github.com/php/php-src/blob/master/ext/standard/tests/strings/substr_replace.phpt

@artengin artengin marked this pull request as draft November 21, 2025 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants