[php-src] Issue #7880: json_decode() native arguments like JSON_OBJECT_AS_ARRAY have the wrong type when using strict type

From: Date: Tue, 04 Jan 2022 10:38:00 +0000
Subject: [php-src] Issue #7880: json_decode() native arguments like JSON_OBJECT_AS_ARRAY have the wrong type when using strict type
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238755@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7880 Comment Author: iluuu1994 That's because you're passing the flag to the wrong parameter. ```php json_decode( string $json, ?bool $associative = null, int $depth = 512, int $flags = 0 ): mixed ``` https://www.php.net/manual/en/function.json-decode.php Use either of these options. ```php // Named arguments, since PHP 8.0 $data = json_decode($test, flags: JSON_OBJECT_AS_ARRAY); // Pass all parameters $data = json_decode($test, null, 512, JSON_OBJECT_AS_ARRAY); ``` https://3v4l.org/noqH9

« previous php.bugs (#238755) next »