Skip to content

Commit aec72eb

Browse files
authored
Merge pull request #84 from TysonAndre/release-2.1.0
Release simdjson 2.1.0
2 parents a860354 + ad454b7 commit aec72eb

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ var_dump($res) //int(5)
106106

107107
```php
108108
<?php
109+
109110
/**
110111
* Similar to json_decode()
111112
*
112113
* @return array|stdClass|string|float|int|bool|null
113-
* @throws RuntimeException for invalid JSON (or document over 4GB, or out of range integer/float)
114+
* @throws SimdJsonException for invalid JSON
115+
* (or document over 4GB, or out of range integer/float)
114116
*/
115117
function simdjson_decode(string $json, bool $assoc = false, int $depth = 512) {}
116118

@@ -125,23 +127,39 @@ function simdjson_is_valid(string $json, int $depth = 512) : ?bool {}
125127
* Parses $json and returns the number of keys in $json matching the JSON pointer $key
126128
*
127129
* @return ?int (null if depth is invalid)
130+
* @throws SimdJsonException for invalid JSON
131+
* (or document over 4GB, or out of range integer/float)
128132
*/
129133
function simdjson_key_count(string $json, string $key, int $depth = 512) : ?int {}
130134

131135
/**
132136
* Returns true if the JSON pointer $key could be found.
133137
*
134138
* @return ?bool (null if depth is invalid, false if json is invalid or key is not found)
139+
* @throws SimdJsonException for invalid JSON
140+
* (or document over 4GB, or out of range integer/float)
135141
*/
136142
function simdjson_key_exists(string $json, string $key, int $depth = 512) : ?bool {}
137143

138144
/**
139145
* Returns the value at $key
140146
*
141147
* @return array|stdClass|string|float|int|bool|null the value at $key
142-
* @throws RuntimeException for invalid JSON (or document over 4GB, or out of range integer/float)
148+
* @throws SimdJsonException for invalid JSON
149+
* (or document over 4GB, or out of range integer/float)
143150
*/
144151
function simdjson_key_value(string $json, string $key, bool $assoc = unknown, int $depth = unknown) {}
152+
153+
/**
154+
* An error thrown by simdjson when processing json.
155+
*
156+
* The error code is available as $e->getCode().
157+
* This can be compared against the `SIMDJSON_ERR_*` constants.
158+
*
159+
* Before simdjson 2.1.0, a regular RuntimeException with an error code of 0 was thrown.
160+
*/
161+
class SimdJsonException extends RuntimeException {
162+
}
145163
```
146164

147165
## Edge cases

package.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
<active>yes</active>
1919
</lead>
2020
-->
21-
<date>2022-10-12</date>
21+
<date>2022-10-14</date>
2222
<version>
23-
<release>2.1.0dev</release>
24-
<api>2.1.0dev</api>
23+
<release>2.1.0</release>
24+
<api>2.1.0</api>
2525
</version>
2626
<stability>
2727
<release>stable</release>

php_simdjson.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
extern zend_module_entry simdjson_module_entry;
1818
#define phpext_simdjson_ptr &simdjson_module_entry
1919

20-
#define PHP_SIMDJSON_VERSION "2.1.0dev"
20+
#define PHP_SIMDJSON_VERSION "2.1.0"
2121
#define SIMDJSON_SUPPORT_URL "https://github.com/crazyxman/simdjson_php"
2222
#define SIMDJSON_PARSE_FAIL 0
2323
#define SIMDJSON_PARSE_SUCCESS 1

0 commit comments

Comments
 (0)