Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Model attributes converted to HTML incorrectly #168

Open
yapsr opened this issue Sep 6, 2018 · 2 comments
Open

Model attributes converted to HTML incorrectly #168

yapsr opened this issue Sep 6, 2018 · 2 comments

Comments

@yapsr
Copy link

yapsr commented Sep 6, 2018

Describe the bug
When updating a model attribute (blog title, event title, page title, faq question, menu name or widget name), the attribute gets converted to HTML. The input is HTML escaped every time.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'CMS'
  2. Click on 'Pages'
  3. Click on 'Edit' of a row
  4. Add a special html character into the title box, i.e. "Sons & Daughters"
  5. Click Save. The title box shows "Sons & Daughters"
  6. Click Save again. The title box shows "Sons & Daughters"

Expected behavior
The value of the attributes should be displayed exactly at it was entered.

Additional context
These lines convert user input to html incorrectly:

vendor\grafite\cms\src\Repositories
BlogRepository.php
        $payload['title'] = htmlentities($payload['title']);
        $payload['title'] = htmlentities($payload['title']);
EventRepository.php
        $payload['title'] = htmlentities($payload['title']);
        $payload['title'] = htmlentities($payload['title']);
FAQRepository.php
        $payload['question'] = htmlentities($payload['question']);
        $payload['question'] = htmlentities($payload['question']);
MenuRepository.php
        $payload['name'] = htmlentities($payload['name']);
        $payload['name'] = htmlentities($payload['name']);
PageRepository.php
        $payload['title'] = htmlentities($payload['title']);
        $payload['title'] = htmlentities($payload['title']);
WidgetRepository.php
        $payload['name'] = htmlentities($payload['name']);
        $payload['name'] = htmlentities($payload['name']);

Possible solution
Remove these lines.

@yapsr yapsr changed the title Model properties repeatedly converted to HTML incorrectly Model attributes converted to HTML incorrectly Sep 6, 2018
@yapsr
Copy link
Author

yapsr commented Mar 8, 2019

@mlantz Could you give your opinion on this, please? I'm running into this and it's a problem.

@yapsr
Copy link
Author

yapsr commented Mar 18, 2019

@mlantz Could you please look into this, please? If requested I can make a simple pull request with the changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant