Permalink
Browse files

Removed JSON encode depth parameter to keep PHP 5.3 compatibility.

  • Loading branch information...
1 parent b30d5e5 commit 9c8d492799da73690ae0c370d8cd685148ef09f5 @mikecao committed Oct 19, 2016
Showing with 9 additions and 13 deletions.
  1. +2 −2 README.md
  2. +1 −1 VERSION
  3. +6 −10 flight/Engine.php
View
@@ -887,8 +887,8 @@ Flight::error($exception) // Sends an HTTP 500 response.
Flight::notFound() // Sends an HTTP 404 response.
Flight::etag($id, [$type]) // Performs ETag HTTP caching.
Flight::lastModified($time) // Performs last modified HTTP caching.
-Flight::json($data, [$code], [$encode], [$charset], [$encodeOption], [$encodeDepth]) // Sends a JSON response.
-Flight::jsonp($data, [$param], [$code], [$encode], [$charset], [$encodeOption], [$encodeDepth]) // Sends a JSONP response.
+Flight::json($data, [$code], [$encode], [$charset], [$option]) // Sends a JSON response.
+Flight::jsonp($data, [$param], [$code], [$encode], [$charset], [$option]) // Sends a JSONP response.
```
Any custom methods added with `map` and `register` can also be filtered.
View
@@ -1 +1 @@
-1.2.22
+1.3.0
View
@@ -457,18 +457,16 @@ public function _render($file, $data = null, $key = null) {
* @param int $code HTTP status code
* @param bool $encode Whether to perform JSON encoding
* @param string $charset Charset
- * @param int $encodeOption Bitmask Json constant such as JSON_HEX_QUOT
- * @param int $encodeDepth Maximum encoding depth, must be greater than 0
+ * @param int $option Bitmask Json constant such as JSON_HEX_QUOT
*/
public function _json(
$data,
$code = 200,
$encode = true,
$charset = 'utf-8',
- $encodeOption = 0,
- $encodeDepth = 512
+ $option = 0
) {
- $json = ($encode) ? json_encode($data, $encodeOption, $encodeDepth) : $data;
+ $json = ($encode) ? json_encode($data, $option) : $data;
$this->response()
->status($code)
@@ -485,19 +483,17 @@ public function _json(
* @param int $code HTTP status code
* @param bool $encode Whether to perform JSON encoding
* @param string $charset Charset
- * @param int $encodeOption Bitmask Json constant such as JSON_HEX_QUOT
- * @param int $encodeDepth Maximum encoding depth, must be greater than 0
+ * @param int $option Bitmask Json constant such as JSON_HEX_QUOT
*/
public function _jsonp(
$data,
$param = 'jsonp',
$code = 200,
$encode = true,
$charset = 'utf-8',
- $encodeOption = 0,
- $encodeDepth = 512
+ $option = 0
) {
- $json = ($encode) ? json_encode($data, $encodeOption, $encodeDepth) : $data;
+ $json = ($encode) ? json_encode($data, $option) : $data;
$callback = $this->request()->query[$param];

0 comments on commit 9c8d492

Please sign in to comment.