Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix json_decode associative argument consistency with PHP #436

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/special_cases.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Wrapper for json_decode that throws when an error occurs.
*
* @param string $json JSON data to parse
* @param bool $assoc When true, returned objects will be converted
* @param bool $associative When true, returned objects will be converted
* into associative arrays.
* @param int<1, max> $depth User specified recursion depth.
* @param int $flags Bitmask of JSON decode options.
Expand All @@ -33,9 +33,9 @@
* @throws JsonException if the JSON cannot be decoded.
* @link http://www.php.net/manual/en/function.json-decode.php
*/
function json_decode(string $json, bool $assoc = false, int $depth = 512, int $flags = 0): mixed
function json_decode(string $json, bool $associative = false, int $depth = 512, int $flags = 0): mixed
{
$data = \json_decode($json, $assoc, $depth, $flags);
$data = \json_decode($json, $associative, $depth, $flags);
if (JSON_ERROR_NONE !== json_last_error()) {
throw JsonException::createFromPhpError();
}
Expand Down