Skip to content

Encoding error in json response for ACL messages for non-english languages #15344

@Ruslan-Aleev

Description

@Ruslan-Aleev

Bug report

Summary

ACL can give an incorrect error message, for example, this.

acl_error_en

It is already not very clear to the end user what exactly the ACL error is.

But if the manager panel is not in english, then json displays messages in incorrect encoding, i.e. it is not even clear that the error is related to ACL.

acl_error_ru

It also makes sense to display specific information in window, for example, the permission that is required (view_template, list_template etc).

Potential solution

Use second parameter for json_encode (available as of php 5.4) to avoid encoding problems:
json_encode($data, JSON_UNESCAPED_UNICODE);

Step to reproduce

Change the language in the manager panel, for example, to russian. Create a user with access policy with view_template disabled in the policy template and try to edit resource.

Expected behavior

Display readable messages.

Related issue(s)/PR(s)

#14506 (Error Messages)

Environment

MODX 2.x>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-corebugThe issue in the code or project, which should be addressed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions