Bug #78515 [Nab]: JSON_THROW_ON_ERROR doesn't throw an exception

From: Date: Mon, 09 Sep 2019 10:18:39 +0000
Subject: Bug #78515 [Nab]: JSON_THROW_ON_ERROR doesn't throw an exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222641@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78515&edit=1 ID: 78515 User updated by: nick dot kdevil at gmail dot com Reported by: nick dot kdevil at gmail dot com Summary: JSON_THROW_ON_ERROR doesn't throw an exception Status: Not a bug Type: Bug Package: JSON related Operating System: Linux PHP Version: 7.3.9 Block user comment: N Private report: N New Comment: the embarassment is real :/ thx nikic Previous Comments: ------------------------------------------------------------------------ [2019-09-09 10:15:58] nikic@php.net Please see the function signature at https://www.php.net/json_decode. You are passing the flag to the $depth parameter, not the $options parameter. ------------------------------------------------------------------------ [2019-09-09 10:13:00] nick dot kdevil at gmail dot com Description: ------------ I was under the impression, that if i have a json_last_error, that if the flag JSON_THROW_ON_ERROR is set, i will get an exception. In the example below json_last_error would return 4, but no exception is thrown. Test script: --------------- json_decode('test',true,JSON_THROW_ON_ERROR); Expected result: ---------------- The appropriate exception is thrown Actual result: -------------- NULL is being returned ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78515&edit=1

« previous php.bugs (#222641) next »