Issue Bug Closed

#60993Notice in charset converter

Attila Szeremi 08/15/14, 12:47 updated 07/11/15, 19:55

Description

https://github.com/TYPO3/TYPO3.CMS/blob/afa3e7f8285f4e30a8a4fbc163fdf616b4e43b80/typo3/sysext/core/Classes/Charset/CharsetConverter.php#L2066
and
https://github.com/TYPO3/TYPO3.CMS/blob/afa3e7f8285f4e30a8a4fbc163fdf616b4e43b80/typo3/sysext/core/Classes/Charset/CharsetConverter.php#L2076

`$str[$i]` triggers a notice if the string is too short, which it shouldn’t be doing especially since the method calling this method is a string shortener (to shorten the string and append “…” if it’s too long).

Suggestion:

instead of:
<pre> if (strlen($str[$i])) ... if (strlen($str[$i])) ... </pre>
do:

<pre> $lastIndex = strlen($str) - 1; if ($i <= $lastIndex) ... if ($i <= $lastIndex) ... </pre>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.