php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_json.h File Reference
#include "php_version.h"
#include "zend_smart_str_public.h"

Go to the source code of this file.

Macros

#define PHP_JSON_VERSION   PHP_VERSION
 
#define phpext_json_ptr   &json_module_entry
 
#define PHP_JSON_API   PHPAPI
 
#define PHP_JSON_OBJECT_AS_ARRAY   (1<<0)
 
#define PHP_JSON_BIGINT_AS_STRING   (1<<1)
 
#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)
 
#define PHP_JSON_INVALID_UTF8_IGNORE   (1<<20)
 
#define PHP_JSON_INVALID_UTF8_SUBSTITUTE   (1<<21)
 
#define PHP_JSON_THROW_ON_ERROR   (1<<22)
 
#define PHP_JSON_OUTPUT_ARRAY   0
 
#define PHP_JSON_OUTPUT_OBJECT   1
 
#define PHP_JSON_PARSER_DEFAULT_DEPTH   512
 
#define JSON_G(v)
 

Enumerations

enum  php_json_error_code {
  PHP_JSON_ERROR_NONE = 0 , PHP_JSON_ERROR_DEPTH , PHP_JSON_ERROR_STATE_MISMATCH , PHP_JSON_ERROR_CTRL_CHAR ,
  PHP_JSON_ERROR_SYNTAX , PHP_JSON_ERROR_UTF8 , PHP_JSON_ERROR_RECURSION , PHP_JSON_ERROR_INF_OR_NAN ,
  PHP_JSON_ERROR_UNSUPPORTED_TYPE , PHP_JSON_ERROR_INVALID_PROPERTY_NAME , PHP_JSON_ERROR_UTF16 , PHP_JSON_ERROR_NON_BACKED_ENUM
}
 

Functions

PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS (json) PHP_JSON_API zend_string *php_json_encode_string(const char *s
 
PHP_JSON_API zend_result php_json_encode_ex (smart_str *buf, zval *val, int options, zend_long depth)
 
PHP_JSON_API zend_result php_json_encode (smart_str *buf, zval *val, int options)
 
PHP_JSON_API zend_result php_json_decode_ex (zval *return_value, const char *str, size_t str_len, zend_long options, zend_long depth)
 
PHP_JSON_API bool php_json_validate_ex (const char *str, size_t str_len, zend_long options, zend_long depth)
 

Variables

zend_module_entry json_module_entry
 
PHP_JSON_API zend_class_entryphp_json_serializable_ce
 
int encoder_depth
 
int encode_max_depth
 
php_json_error_code error_code
 
PHP_JSON_API size_t len
 
PHP_JSON_API size_t int options
 

Macro Definition Documentation

◆ JSON_G

#define JSON_G ( v)
Value:
uint32_t v
Definition cdf.c:1237
#define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v)
Definition zend_API.h:274

◆ PHP_JSON_API

#define PHP_JSON_API   PHPAPI

Definition at line 32 of file php_json.h.

◆ PHP_JSON_BIGINT_AS_STRING

#define PHP_JSON_BIGINT_AS_STRING   (1<<1)

Definition at line 59 of file php_json.h.

◆ PHP_JSON_FORCE_OBJECT

#define PHP_JSON_FORCE_OBJECT   (1<<4)

Definition at line 66 of file php_json.h.

◆ PHP_JSON_HEX_AMP

#define PHP_JSON_HEX_AMP   (1<<1)

Definition at line 63 of file php_json.h.

◆ PHP_JSON_HEX_APOS

#define PHP_JSON_HEX_APOS   (1<<2)

Definition at line 64 of file php_json.h.

◆ PHP_JSON_HEX_QUOT

#define PHP_JSON_HEX_QUOT   (1<<3)

Definition at line 65 of file php_json.h.

◆ PHP_JSON_HEX_TAG

#define PHP_JSON_HEX_TAG   (1<<0)

Definition at line 62 of file php_json.h.

◆ PHP_JSON_INVALID_UTF8_IGNORE

#define PHP_JSON_INVALID_UTF8_IGNORE   (1<<20)

Definition at line 76 of file php_json.h.

◆ PHP_JSON_INVALID_UTF8_SUBSTITUTE

#define PHP_JSON_INVALID_UTF8_SUBSTITUTE   (1<<21)

Definition at line 79 of file php_json.h.

◆ PHP_JSON_NUMERIC_CHECK

#define PHP_JSON_NUMERIC_CHECK   (1<<5)

Definition at line 67 of file php_json.h.

◆ PHP_JSON_OBJECT_AS_ARRAY

#define PHP_JSON_OBJECT_AS_ARRAY   (1<<0)

Definition at line 58 of file php_json.h.

◆ PHP_JSON_OUTPUT_ARRAY

#define PHP_JSON_OUTPUT_ARRAY   0

Definition at line 83 of file php_json.h.

◆ PHP_JSON_OUTPUT_OBJECT

#define PHP_JSON_OUTPUT_OBJECT   1

Definition at line 84 of file php_json.h.

◆ PHP_JSON_PARSER_DEFAULT_DEPTH

#define PHP_JSON_PARSER_DEFAULT_DEPTH   512

Definition at line 87 of file php_json.h.

◆ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR

#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR   (1<<9)

Definition at line 71 of file php_json.h.

◆ PHP_JSON_PRESERVE_ZERO_FRACTION

#define PHP_JSON_PRESERVE_ZERO_FRACTION   (1<<10)

Definition at line 72 of file php_json.h.

◆ PHP_JSON_PRETTY_PRINT

#define PHP_JSON_PRETTY_PRINT   (1<<7)

Definition at line 69 of file php_json.h.

◆ PHP_JSON_THROW_ON_ERROR

#define PHP_JSON_THROW_ON_ERROR   (1<<22)

Definition at line 80 of file php_json.h.

◆ PHP_JSON_UNESCAPED_LINE_TERMINATORS

#define PHP_JSON_UNESCAPED_LINE_TERMINATORS   (1<<11)

Definition at line 73 of file php_json.h.

◆ PHP_JSON_UNESCAPED_SLASHES

#define PHP_JSON_UNESCAPED_SLASHES   (1<<6)

Definition at line 68 of file php_json.h.

◆ PHP_JSON_UNESCAPED_UNICODE

#define PHP_JSON_UNESCAPED_UNICODE   (1<<8)

Definition at line 70 of file php_json.h.

◆ PHP_JSON_VERSION

#define PHP_JSON_VERSION   PHP_VERSION

Definition at line 24 of file php_json.h.

◆ phpext_json_ptr

#define phpext_json_ptr   &json_module_entry

Definition at line 27 of file php_json.h.

Enumeration Type Documentation

◆ php_json_error_code

Enumerator
PHP_JSON_ERROR_NONE 
PHP_JSON_ERROR_DEPTH 
PHP_JSON_ERROR_STATE_MISMATCH 
PHP_JSON_ERROR_CTRL_CHAR 
PHP_JSON_ERROR_SYNTAX 
PHP_JSON_ERROR_UTF8 
PHP_JSON_ERROR_RECURSION 
PHP_JSON_ERROR_INF_OR_NAN 
PHP_JSON_ERROR_UNSUPPORTED_TYPE 
PHP_JSON_ERROR_INVALID_PROPERTY_NAME 
PHP_JSON_ERROR_UTF16 
PHP_JSON_ERROR_NON_BACKED_ENUM 

Definition at line 42 of file php_json.h.

Function Documentation

◆ php_json_decode_ex()

PHP_JSON_API zend_result php_json_decode_ex ( zval * return_value,
const char * str,
size_t str_len,
zend_long options,
zend_long depth )

Definition at line 180 of file json.c.

◆ php_json_encode()

PHP_JSON_API zend_result php_json_encode ( smart_str * buf,
zval * val,
int options )

Definition at line 141 of file json.c.

◆ php_json_encode_ex()

PHP_JSON_API zend_result php_json_encode_ex ( smart_str * buf,
zval * val,
int options,
zend_long depth )

Definition at line 126 of file json.c.

◆ php_json_validate_ex()

PHP_JSON_API bool php_json_validate_ex ( const char * str,
size_t str_len,
zend_long options,
zend_long depth )

Definition at line 202 of file json.c.

◆ ZEND_EXTERN_MODULE_GLOBALS()

PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS ( json ) const

Variable Documentation

◆ encode_max_depth

int encode_max_depth

Definition at line 91 of file php_json.h.

◆ encoder_depth

int encoder_depth

Definition at line 90 of file php_json.h.

◆ error_code

php_json_error_code error_code

Definition at line 92 of file php_json.h.

◆ json_module_entry

zend_module_entry json_module_entry
extern

Definition at line 77 of file json.c.

◆ len

PHP_JSON_API size_t len

Definition at line 102 of file php_json.h.

◆ options

PHP_JSON_API size_t int options

Definition at line 102 of file php_json.h.

◆ php_json_serializable_ce

PHP_JSON_API zend_class_entry* php_json_serializable_ce
extern

Definition at line 33 of file json.c.