-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: IncomingRequest::getJsonVar()
may cause TypeError
#5392
Conversation
See codeigniter4#5391 [TypeError] dot_array_search(): Argument #2 ($array) must be of type array, null given, called in .../system/HTTP/IncomingRequest.php on line 540 at SYSTEMPATH/Helpers/array_helper.php:21
ErrorException: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
JSON can contain null as a value. Therefore, I do not know if this way of solving the problem is correct. |
If the user input is |
i mean // body: {"var" : null}
$request->getVar('var'); // null
// body: {}
$request->getVar('var'); // null
// body: null
$request->getVar('var'); // null If we assume that the value "var" can be null, then the last two examples are incorrect behavior. If we compare it with working with an array, then: $a = [];
$a['test'];
// Warning: Undefined array key "test"
$a = null;
$a['test'];
// Warning: Trying to access array offset on value of type null |
It depends on If it should throw an exception, #5391 is not a bug. |
@kenjis could you verify PHPUnit error on develop branch? |
@samsonasik Do you mean this?
It is an error of PhpCoveralls: php-coveralls/php-coveralls#327 |
Yes, is there a way to pin to specific coveralls version that is working? |
Adding this to composer.json?
|
Yes, that's probably the temporary fix 👍 |
@samsonasik Okay, I will do it. |
Description
Fixes #5391
Checklist: