}
/* }}} */
-PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options) /* {{{ */
+PHP_JSON_API int php_json_encode_ex(smart_str *buf, zval *val, int options, zend_long depth) /* {{{ */
{
php_json_encoder encoder;
int return_code;
php_json_encode_init(&encoder);
- encoder.max_depth = JSON_G(encode_max_depth);
- encoder.error_code = PHP_JSON_ERROR_NONE;
+ encoder.max_depth = depth;
return_code = php_json_encode_zval(buf, val, options, &encoder);
JSON_G(error_code) = encoder.error_code;
}
/* }}} */
+PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options) /* {{{ */
+{
+ return php_json_encode_ex(buf, val, options, JSON_G(encode_max_depth));
+}
+/* }}} */
+
PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */
{
php_json_parser parser;
php_json_encode_init(&encoder);
encoder.max_depth = (int)depth;
- encoder.error_code = PHP_JSON_ERROR_NONE;
php_json_encode_zval(&buf, parameter, (int)options, &encoder);
JSON_G(error_code) = encoder.error_code;
ZEND_TSRMLS_CACHE_EXTERN()
#endif
+PHP_JSON_API int php_json_encode_ex(smart_str *buf, zval *val, int options, zend_long depth);
PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options);
PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth);
return php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth);
}
-
#endif /* PHP_JSON_H */
/*