Skip to content

Commit

Permalink
Fix compatability with PHP5.3
Browse files Browse the repository at this point in the history
The Following constants are only defined as of PHP5.4, and are assumed to be strings by the interpreter:
- JSON_PRETTY_PRINT
- JSON_UNESCAPED_UNICODE
  • Loading branch information
tyzoid committed Dec 2, 2016
1 parent adfa146 commit 6288f32
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/Jacwright/RestServer/RestServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,14 @@ public function sendData($data)
}
}
$options = 0;
if ($this->mode == 'debug') {
if ($this->mode == 'debug' && defined('JSON_PRETTY_PRINT')) {
$options = JSON_PRETTY_PRINT;
}
$options = $options | JSON_UNESCAPED_UNICODE;

if (defined('JSON_UNESCAPED_UNICODE')) {
$options = $options | JSON_UNESCAPED_UNICODE;
}

echo json_encode($data, $options);
}
}
Expand Down

0 comments on commit 6288f32

Please sign in to comment.