Skip to content

Xoops_Locale_Abstract::substr #545

@zyspec

Description

@zyspec

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions