Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xoops_Locale_Abstract::substr #545

Open
zyspec opened this issue Apr 17, 2017 · 0 comments
Open

Xoops_Locale_Abstract::substr #545

zyspec opened this issue Apr 17, 2017 · 0 comments

Comments

@zyspec
Copy link

zyspec commented Apr 17, 2017

Enhancement

The substr() method has the probability of "breaking" HTML entities passed into the method if the input string is longer than the $length param. It seems there's 3 potential solutions:

  1. Always strip HTML entities then return the $length string.
  2. Strip HTML first if the rendered string is longer than $length, otherwise return HTML string.
  3. Use DOMElement object and sequentially cycle through the childNodes and add them to the returned string if the "length" of the rendered string is <= $length. Otherwise truncate the string at the end of the previous childNode. The string returned may end up shorter than the requested $length but at least it would render correctly.

This is also a potential issue in XOOPS 2.5.x XoopsLocalAbstract::substr() method.

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

No branches or pull requests

1 participant