summaryrefslogtreecommitdiff
path: root/ext/json/php_json.h
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2017-07-16 12:35:24 +0100
committerJakub Zelenka <bukka@php.net>2017-07-16 12:35:24 +0100
commit0d0f7cde8c321ae841ba0f60f4377b72f98db637 (patch)
tree9382ab16cf35c723187e4894b2c0bb38d490abb4 /ext/json/php_json.h
parentf6a44916623f9d8dc24d35d52f2998700f0567a6 (diff)
downloadphp-git-0d0f7cde8c321ae841ba0f60f4377b72f98db637.tar.gz
Add JSON_INVALID_UTF8_SUBSTITUTE and JSON_INVALID_UTF8_IGNORE
It implements request #65082 and adds options for replacing resp. ignoring invalid UTF-8 sequences for json_encode and json_decode.
Diffstat (limited to 'ext/json/php_json.h')
-rw-r--r--ext/json/php_json.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 992f42c087..e772d8d0c2 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -55,23 +55,27 @@ typedef enum {
PHP_JSON_ERROR_UTF16
} php_json_error_code;
+/* json_decode() options */
+#define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
+#define PHP_JSON_BIGINT_AS_STRING (1<<1)
+
/* json_encode() options */
-#define PHP_JSON_HEX_TAG (1<<0)
-#define PHP_JSON_HEX_AMP (1<<1)
-#define PHP_JSON_HEX_APOS (1<<2)
-#define PHP_JSON_HEX_QUOT (1<<3)
-#define PHP_JSON_FORCE_OBJECT (1<<4)
-#define PHP_JSON_NUMERIC_CHECK (1<<5)
-#define PHP_JSON_UNESCAPED_SLASHES (1<<6)
-#define PHP_JSON_PRETTY_PRINT (1<<7)
-#define PHP_JSON_UNESCAPED_UNICODE (1<<8)
-#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9)
-#define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10)
+#define PHP_JSON_HEX_TAG (1<<0)
+#define PHP_JSON_HEX_AMP (1<<1)
+#define PHP_JSON_HEX_APOS (1<<2)
+#define PHP_JSON_HEX_QUOT (1<<3)
+#define PHP_JSON_FORCE_OBJECT (1<<4)
+#define PHP_JSON_NUMERIC_CHECK (1<<5)
+#define PHP_JSON_UNESCAPED_SLASHES (1<<6)
+#define PHP_JSON_PRETTY_PRINT (1<<7)
+#define PHP_JSON_UNESCAPED_UNICODE (1<<8)
+#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9)
+#define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10)
#define PHP_JSON_UNESCAPED_LINE_TERMINATORS (1<<11)
-/* json_decode() options */
-#define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
-#define PHP_JSON_BIGINT_AS_STRING (1<<1)
+/* json_decode() and json_encode() common options */
+#define PHP_JSON_INVALID_UTF8_IGNORE (1<<20)
+#define PHP_JSON_INVALID_UTF8_SUBSTITUTE (1<<21)
/* Internal flags */
#define PHP_JSON_OUTPUT_ARRAY 0