Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27360

The remove template operator won't work with UTF8 characters

    Details

      Description

      Since the remove template operator is based on the PHP function substr, which cannot handle utf8 strings, the operator will return weird � characters if used with special chars.

      Please check custom proposed fix:
      https://github.com/mugoweb/ezpublish-legacy/pull/57 Edit: Now https://github.com/ezsystems/ezpublish-legacy/pull/1298

      Steps to reproduce.
      • Edit a legacy tpl template, and add the following code to it:

        {'fipsï'|remove( 4,1 )}

      • Clear the caches, and open the respective content in the frontend
      • Confirm the code will return �, instead ï

        Activity

        Eduardo Fernandes (Inactive) created issue -
        Eduardo Fernandes (Inactive) made changes -
        Field Original Value New Value
        Link This issue relates to CS-6191 [ CS-6191 ]
        Eduardo Fernandes (Inactive) made changes -
        Status Open [ 1 ] Confirmed [ 10037 ]
        Eduardo Fernandes (Inactive) made changes -
        Status Confirmed [ 10037 ] InputQ [ 10001 ]
        Gunnstein Lye made changes -
        Assignee Gunnstein Lye [ gunnstein.lye@ez.no ]
        Hide
        Gunnstein Lye added a comment -

        PR by pkamps: https://github.com/ezsystems/ezpublish-legacy/pull/1298

        (See also older PR by brookinsconsulting which autodetects presence of mb_ functions: https://github.com/ezsystems/ezpublish-legacy/pull/1162 This should not be needed as mbstring is a requirement.)

        Show
        Gunnstein Lye added a comment - PR by pkamps: https://github.com/ezsystems/ezpublish-legacy/pull/1298 (See also older PR by brookinsconsulting which autodetects presence of mb_ functions: https://github.com/ezsystems/ezpublish-legacy/pull/1162 This should not be needed as mbstring is a requirement.)
        Gunnstein Lye logged work - 15/May/17 2:30 PM
        • Time Spent:
          30 minutes
           

          .

        Gunnstein Lye made changes -
        Status InputQ [ 10001 ] Development [ 3 ]
        Gunnstein Lye made changes -
        Status Development [ 3 ] Development Review [ 10006 ]
        Gunnstein Lye made changes -
        Description Since the remove template operator is based on the PHP function substr, which cannot handle utf8 strings, the operator will return weird � characters if used with special chars.

        Please check custom proposed fix:
        https://github.com/mugoweb/ezpublish-legacy/pull/57

        h6. Steps to reproduce.

        - Edit a legacy tpl template, and add the following code to it:
        {code}{'fipsï'|remove( 4,1 )}{code}
        - Clear the caches, and open the respective content in the frontend
        - Confirm the code will return �, instead ï
        Since the remove template operator is based on the PHP function substr, which cannot handle utf8 strings, the operator will return weird � characters if used with special chars.

        Please check custom proposed fix:
        https://github.com/mugoweb/ezpublish-legacy/pull/57 Edit: Now https://github.com/ezsystems/ezpublish-legacy/pull/1298

        h6. Steps to reproduce.

        - Edit a legacy tpl template, and add the following code to it:
        {code}{'fipsï'|remove( 4,1 )}{code}
        - Clear the caches, and open the respective content in the frontend
        - Confirm the code will return �, instead ï
        Gunnstein Lye made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 30 minutes [ 1800 ]
        Worklog Id 64094 [ 64094 ]
        Gunnstein Lye made changes -
        Status Development Review [ 10006 ] Documentation Review done [ 10011 ]
        Affects Version/s 5.3.11 [ 14610 ]
        Assignee Gunnstein Lye [ gunnstein.lye@ez.no ]
        Rui Silva (Inactive) made changes -
        Status Documentation Review done [ 10011 ] QA [ 10008 ]
        Hide
        Rui Silva (Inactive) added a comment -

        Tested and approved by QA for 5.4.
        As per Gunnstein Lye's request, this was also tested on a 5.3 and it also solves the issue.

        Show
        Rui Silva (Inactive) added a comment - Tested and approved by QA for 5.4. As per Gunnstein Lye 's request, this was also tested on a 5.3 and it also solves the issue.
        Hide
        Rui Silva (Inactive) added a comment -

        Sending back to dev-needed so that PR can be merged.
        Please send back to QA afterwards so that QA can inform Support Team that a fix is ready for the customer.
        Thank you.

        Show
        Rui Silva (Inactive) added a comment - Sending back to dev-needed so that PR can be merged. Please send back to QA afterwards so that QA can inform Support Team that a fix is ready for the customer. Thank you.
        Rui Silva (Inactive) made changes -
        Status QA [ 10008 ] InputQ [ 10001 ]
        Assignee Rui Silva [ rui.silva@ez.no ]
        Gunnstein Lye logged work - 26/May/17 3:00 PM
        • Time Spent:
          30 minutes
           

          .

        Show
        Gunnstein Lye added a comment - Merged in master: https://github.com/ezsystems/ezpublish-legacy/commit/154214ef06442ede74ca2ab1a4aa9ea14630861e
        Gunnstein Lye made changes -
        Fix Version/s 5.3.12 [ 14639 ]
        Fix Version/s 5.4.10 [ 14640 ]
        Gunnstein Lye made changes -
        Status InputQ [ 10001 ] Development [ 3 ]
        Assignee Gunnstein Lye [ gunnstein.lye@ez.no ]
        Gunnstein Lye made changes -
        Status Development [ 3 ] Development Review [ 10006 ]
        Gunnstein Lye made changes -
        Status Development Review [ 10006 ] Documentation Review done [ 10011 ]
        Assignee Gunnstein Lye [ gunnstein.lye@ez.no ]
        Gunnstein Lye made changes -
        Time Spent 30 minutes [ 1800 ] 1 hour [ 3600 ]
        Worklog Id 64445 [ 64445 ]
        Rui Silva (Inactive) made changes -
        Status Documentation Review done [ 10011 ] QA [ 10008 ]
        Rui Silva (Inactive) made changes -
        Assignee Rui Silva [ rui.silva@ez.no ]
        Status QA [ 10008 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Alex Schuster made changes -
        Workflow EZ* Development Workflow [ 103837 ] EZEE Development Workflow [ 126485 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Confirmed Confirmed
        1m 5s 1 eduardo.fernandes@ez.no 12/May/17 4:17 PM
        Confirmed Confirmed InputQ InputQ
        15s 1 eduardo.fernandes@ez.no 12/May/17 4:17 PM
        QA QA InputQ InputQ
        1d 32m 1 rui.silva@ez.no 24/May/17 4:26 PM
        InputQ InputQ Development Development
        4d 21h 43m 2 Gunnstein Lye 26/May/17 3:56 PM
        Development Development Development Review Development Review
        9s 2 Gunnstein Lye 26/May/17 3:56 PM
        Development Review Development Review Documentation Review done Documentation Review done
        8d 1h 8m 2 Gunnstein Lye 26/May/17 3:56 PM
        Documentation Review done Documentation Review done QA QA
        2d 17h 33m 2 rui.silva@ez.no 29/May/17 9:16 AM
        QA QA Closed Closed
        15s 1 rui.silva@ez.no 29/May/17 9:16 AM

          People

          • Assignee:
            Unassigned
            Reporter:
            Eduardo Fernandes (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 hour
              1h