Add default value NULL for method getArray() for notexist values in Input.php #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
for a single Input value, it is possible to set a default value. But for the value in the array, there is no such possibility. And it is also a tragedy when a non-existent field in the array causes an error. Firstly, we do not have the ability to apply the default value, but in addition an error is caused.
The
$datavariable should return all the request fields after processing the STRING filter.But we see that the filter keys have other indexes in the array. Such code will cause an error.
Since there is no field with index 0 in the request.
As an alternative, we don't have the option to set default values. Therefore, the
getArray()method should return the default valueNULL. Thanks to this, we can later check for the presence of a value with an index of 0.All simple methods always return
NULLby default. Methods such asgetInt(),getString(),getCmd(),getHtml()and others returnNULL. But thegetArray()method for a nonexistent field causes an error.But:
This amendment cannot violate backward compatibility. Since the amendment corrects the error message. And I can also conclude that this method is not used by anyone. Since I didn't find any documentation on how this method works in the Joomla Doc help. Which means that developers do not use this method at all. Developers use simple methods.
getInt(),getCmd()...Otherwise, this error would have been discovered long ago.