Skip to content

Commit

Permalink
CIL-540 Don't escape backslashes in JSON to save some characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
terrencegf committed Mar 30, 2020
1 parent 3b7317d commit 7014117
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Service/DBService.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,11 @@ public function getUser(...$args)
// If any elements in $attr_arr, append converted JSON object
if (count($attr_arr) > 0) {
if (
($attr_json = json_encode($attr_arr, JSON_FORCE_OBJECT))
!== false
($attr_json = json_encode(
$attr_arr,
JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES
)
) !== false
) {
$cmd .= '&attr_json=' . urlencode($attr_json);
}
Expand Down
5 changes: 4 additions & 1 deletion src/Service/IdpList.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ public function writeJSON()
if (!is_null($this->idparray)) {
$filename = $this->getFilename();
$tmpfname = tempnam('/tmp', 'JSON');
$json = json_encode($this->idparray, JSON_FORCE_OBJECT);
$json = json_encode(
$this->idparray,
JSON_FORCE_OBJECT | JSON_UNESCAPED_SLASHES
);
if (
((file_put_contents($tmpfname, $json)) !== false) &&
(@rename($tmpfname, $filename))
Expand Down

0 comments on commit 7014117

Please sign in to comment.