Added ability to pass options to JSON encoding (#2106)
authorStefan <Stefan_Hahn1@gmx.net>
Fri, 9 Sep 2016 10:58:50 +0000 (12:58 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 9 Sep 2016 10:58:50 +0000 (12:58 +0200)
* Added ability to pass options to json encoding

* Don't duplicate the JSON options constants

wcfsetup/install/files/lib/util/JSON.class.php

index c9512ce916f0197fafda34bff1e7571fa1df51f5..167ea5420b089a3faefb2f8d55df6fa4189eeef2 100644 (file)
@@ -15,10 +15,11 @@ final class JSON {
         * Returns the JSON representation of a value.
         * 
         * @param       mixed           $data
+        * @param       integer         $options
         * @return      string
         */
-       public static function encode($data) {
-               return json_encode($data);
+       public static function encode($data, $options = 0) {
+               return json_encode($data, $options);
        }
        
        /**