From 9c8d492799da73690ae0c370d8cd685148ef09f5 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 19 Oct 2016 10:01:27 -0700 Subject: [PATCH] Removed JSON encode depth parameter to keep PHP 5.3 compatibility. --- README.md | 4 ++-- VERSION | 2 +- flight/Engine.php | 16 ++++++---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6f469da..1a68de5 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/VERSION b/VERSION index 9a83513..589268e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.22 +1.3.0 \ No newline at end of file diff --git a/flight/Engine.php b/flight/Engine.php index 8989215..1f4ea36 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -457,18 +457,16 @@ class Engine { * @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,8 +483,7 @@ class Engine { * @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, @@ -494,10 +491,9 @@ class Engine { $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];