Salamek/PplMyApi

Sender.php, Recipient.php - setStreet(), setCity(), setName()... character limit diacritics issue

Closed this issue · 3 comments

Hi,

in Sender.php and Recipient.php, there is an issue with setXXXX() functions in case when diacritics are included in the string.
Function strlen() counts 1 character with diacritic as 2 characters, which can lead to the issues.

strlen('Dukelských bojovníků 155/3638'); //32
mb_strlen('Dukelských bojovníků 155/3638'); //29

I'm not sure whether PPL counts with the diacritics or not, but I would recommend either using mb_strlen() instead of strlen() or stripping the diacritics off from all the user input data.

Thanks for the fix.

I'm not sure whether PPL counts with the diacritics or not

Try call to PPL and ask, if they counts or not ;). This is a important information.

@JanGalek well we can test it by calling PPL API... it should throw error or something... well if docs are correct.
But i dont have a time to test it right now... 😢 anyone willing to look on it ?

I just checked with our PPL contact person, diacritics should not be an issue on their side. So using the mb_strlen() will be an easy fix.
Also, you could fix the grammar issue in the sentence "$XXXX is longer then YY characters". It should be "than", not "then".

Thanks in advance.