@@ -116,7 +116,7 @@ typedef uint8_t simdjson_php_error_code;
116116/* NOTE: Callers should check if len is greater than 4GB - simdjson will always return a non zero error code for those */
117117
118118/* FIXME add php_simdjson_get_default_singleton_parser api */
119- /* FIXME add php_simdjson_decode_with_default_singleton_parser(return_value, json, len, bool assoc ) */
119+ /* FIXME add php_simdjson_decode_with_default_singleton_parser(return_value, json, len, bool associative ) */
120120
121121/**
122122 * Returns the error message corresponding to a given error code returned by a call to simdjson_php.
@@ -133,6 +133,8 @@ PHP_SIMDJSON_API void php_simdjson_throw_jsonexception(simdjson_php_error_code c
133133 *
134134 * Callers may use this instead of the shared singleton parser when memory usage is a concern
135135 * (e.g. the PECLs are likely to be used load a string that's megabytes long in a long-lived php process)
136+ *
137+ * Callers should free this parser before or during the request shutdown phase.
136138 */
137139PHP_SIMDJSON_API struct simdjson_php_parser * php_simdjson_create_parser (void );
138140/**
@@ -143,13 +145,20 @@ PHP_SIMDJSON_API void php_simdjson_free_parser(struct simdjson_php_parser* parse
143145 * Returns true if the given json string is valid
144146 */
145147PHP_SIMDJSON_API bool php_simdjson_is_valid (struct simdjson_php_parser * parser , const char * json , size_t len , size_t depth );
148+ /**
149+ * Parses the given string into a return code, using the default singleton parser.
150+ *
151+ * This must be called after simdjson's request initialization phase and before simdjson's request shutdown phase.
152+ * (e.g. PECLs should not use this during module or request initialization/shutdown)
153+ */
154+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse_default (const char * json , size_t len , zval * return_value , bool associative , size_t depth );
146155/**
147156 * Parses the given string into a return code.
148157 *
149158 * If the returned error code is 0, then return_value contains the parsed value.
150159 * If the returned error code is non-0, then return_value will not be initialized.
151160 */
152- PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse (struct simdjson_php_parser * parser , const char * json , size_t len , zval * return_value , bool assoc , size_t depth );
161+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse (struct simdjson_php_parser * parser , const char * json , size_t len , zval * return_value , bool associative , size_t depth );
153162/**
154163 * Parses the part of the given string at the json pointer 'key' into a PHP value at return_value
155164 *
@@ -161,7 +170,7 @@ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_parse(struct simdjson_php_
161170 *
162171 * @see https://www.rfc-editor.org/rfc/rfc6901.html
163172 */
164- PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_key_value (struct simdjson_php_parser * parser , const char * json , size_t len , const char * key , zval * return_value , bool assoc , size_t depth );
173+ PHP_SIMDJSON_API simdjson_php_error_code php_simdjson_key_value (struct simdjson_php_parser * parser , const char * json , size_t len , const char * key , zval * return_value , bool associative , size_t depth );
165174/**
166175 * Checks if the json pointer 'key' exists in the given json string.
167176 *
0 commit comments