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

dev/core#1335 - Prevent php warning when saving case type #15554

Merged
merged 1 commit into from
Oct 20, 2019

Conversation

demeritcowboy
Copy link
Contributor

Overview

htmlspecialchars is being passed an array sometimes. It also prevents unit tests from running if they do something like retrieve a case type via api and then try to save it again even without changing anything.
https://lab.civicrm.org/dev/core/issues/1335

Before

As described in the lab ticket there's warnings in drupal watchdog. Also the attached added test gives 3 fails:

CRM_Case_BAO_CaseTypeTest::testConvertDefinitionToXml
CRM_Case_BAO_CaseTypeTest::testRoundtrip_XmlToJsonToXml
CRM_Case_BAO_CaseTypeTest::testRoundtrip_JsonToXmlToJson

htmlspecialchars() expects parameter 1 to be string, array given
.../CRM/Case/BAO/CaseType.php:222
.../CRM/Case/BAO/CaseType.php:154

After

Better

Technical Details

Comments

@civibot
Copy link

civibot bot commented Oct 20, 2019

(Standard links)

@civibot civibot bot added the master label Oct 20, 2019
@mattwire
Copy link
Contributor

@demeritcowboy Thanks, technically this introduces a small changes as we insert NULL into the string instead of ''. But in practise I don't think that makes any difference!

@mattwire mattwire merged commit ec21196 into civicrm:master Oct 20, 2019
@demeritcowboy
Copy link
Contributor Author

Thanks. Actually @mattwire I realized after first trying '' that htmlspecialchars returns null when passed an array, so this is as close to NFC as I could get. And it does seem to make a difference when using ''.

@demeritcowboy demeritcowboy deleted the casetype-xml-array branch October 20, 2019 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants