? ? ? Failure

User tests: Successful: Unsuccessful:

avatar nevigen
nevigen
9 Jul 2020

We should use an utf8 compatible function for replacing

avatar nevigen nevigen - open - 9 Jul 2020
avatar nevigen nevigen - change - 9 Jul 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Jul 2020
Category Front End Plugins
avatar nevigen nevigen - change - 9 Jul 2020
The description was changed
avatar nevigen nevigen - edited - 9 Jul 2020
avatar ReLater
ReLater - comment - 9 Jul 2020

Could you please provide detailed testing instructions (a use case where str_replace fails). Then people can test this change and see why this change is needed. Thank you! You need 2 successful tests by others before a pr cen be merged.

avatar nevigen
nevigen - comment - 9 Jul 2020

substr_replace doesn't work correctly if we have a non-latin characters (characters which takes more than 1 byte, like cyrylic, etc) in our $article->text

avatar ReLater
ReLater - comment - 9 Jul 2020

As I've said: Provide a reproducible use case, please, if you want to speed up testing. We not only have experts as testers here.

  • Do that

  • Do this

  • Then do that

  • See that it fails

  • Apply patch

  • Test again...

avatar Fedik
Fedik - comment - 10 Jul 2020

If you use Joomla\String\StringHelper::substr_replace() because substr_replace() fail with UTF-8, then you also should use Joomla\String\StringHelper::strlen() instead of strlen(), in same reason.

And as @ReLater said, the test instruction are required.

avatar infograf768
infograf768 - comment - 10 Jul 2020

I wonder if we do not have other instances where this change would be welcome.

avatar richard67
richard67 - comment - 11 Jul 2020

If you use Joomla\String\StringHelper::substr_replace() because substr_replace() fail with UTF-8, then you also should use Joomla\String\StringHelper::strlen() instead of strlen(), in same reason.

@Fedik The same applies to strpos(), right?

avatar Fedik
Fedik - comment - 11 Jul 2020

The same applies to strpos(), right?

yeap

avatar richard67
richard67 - comment - 11 Jul 2020

@nevigen Please apply the same change to strlen and strpos calls, otherwise the code still will not be utf-8 aware. And please provide some small easy testing instructions. Thanks in advance.

avatar richard67
richard67 - comment - 11 Jul 2020

Added the "Updates Requested" label due to necessary changes mentioned in my previous comment.

avatar SharkyKZ
SharkyKZ - comment - 11 Jul 2020

If this is really causing issues, use preg_quote() approach proposed in #21948. utf8 functions are very slow.

avatar SharkyKZ
SharkyKZ - comment - 11 Jul 2020

Would be nice to have unit tests for this plugin. But first we really need testing instructions.

avatar nevigen nevigen - change - 23 Dec 2020
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2020-12-23 09:12:36
Closed_By nevigen
Labels Added: ? ?
avatar nevigen nevigen - close - 23 Dec 2020

Add a Comment

Login with GitHub to post a comment