Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Prevent semicolon in last value breaking rest clapi serialization #6234

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

richardlawley
Copy link
Contributor

At the moment, trying to use the REST API to retrieve a value containing a semicolon causes the serialization to break. This is broken on the default install by the host-notify-by-jabber command, which contains the HTML entities '.

The problem is caused by the semicolon being used to split the values. This causes there to be more values than headers, and array_combine then returns false for that item.

To get around this, this PR checks for there being more values than headers, and if so, recombines all of the last items into one value. This catches the case where the last item contains a semicolon (e.g. the "line" parameter of command). This will not work if semicolon is present in any field other than the last.

This isn't an ideal solution - it would be better to either have a way to escape semicolons in the CLAPI output, or preventing semicolons being added (unlikely to be possible for things like commands).

Fixes #6110

@chgautier
Copy link
Contributor

Fix OK on branch 6234-rest-clapi-serialization-fix. no element is replaced by false.

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

Successfully merging this pull request may close these issues.

5 participants