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

Add test and fix for API4 failing to decode strings stored as HTML #21549

Merged

Conversation

artfulrobot
Copy link
Contributor

Overview

See
https://chat.civicrm.org/civicrm/pl/yw3u69gi1jnjuek6q8c1s7iq7c

Before

Calling an API DAO create or update with a string returns htmlspecialchars(string) instead of the same string as you wanted to store.

This was not picked up by tests.

After

Same, but this is picked up by tests.

Technical Details

Note that .get actions seem to work OK.

@civibot civibot bot added the master label Sep 20, 2021
@civibot
Copy link

civibot bot commented Sep 20, 2021

(Standard links)

@artfulrobot artfulrobot force-pushed the artfulrobot-htmlencoding-api-output branch from b85b7ee to 2dda69c Compare September 20, 2021 13:52
CiviCRM regrettably stores most strings as HTML in the database.
This fixes the output of APIv4 write operations to decode them and return non-html
@colemanw colemanw force-pushed the artfulrobot-htmlencoding-api-output branch from 2dda69c to 067dea4 Compare September 20, 2021 14:04
@colemanw
Copy link
Member

I confirmed the test fails without this fix. Merge-on-pass.

@artfulrobot artfulrobot changed the title Add test for API4 failing to decode strings stored as HTML Add test and fix for API4 failing to decode strings stored as HTML Sep 20, 2021
@artfulrobot
Copy link
Contributor Author

Works for me, thanks for super speedy response, @colemanw

@colemanw colemanw merged commit 3eaf408 into civicrm:master Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants