Sanitizing arrays loses data except first item
See original GitHub issueVersion: express-validator 6.2.0
Send POST data:
{
title: "test",
genre: ["aaa", "bbb", "ccc"]
}
After sanitizeBody("*").escape()
POST data changed to:
{
title: "test",
genre: "aaa"
}
And array data of genre
lost!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
PHP: array values lost after for each - Stack Overflow
I've got an array of user items, consisting of an ID(item_id) and quantity(e.g. 10 items) If a user purchases an item, it's added...
Read more >Sanitizing Arrays: The WordPress Settings API - Tom McFarlin
Here is Part 1. Yesterday, I started talking about how to sanitize multiple values with the WordPress Settings API.
Read more >Weird validation where field is an array · Issue #883 · express ...
Doesn't matter the values are array, it seems to only check if the first element is valid. Is this expected behavior?
Read more >10 Most Common Mistakes That PHP Developers Make - Toptal
Just a warning: When using non-empty arrays, count($array) can slow down your code significantly. What's more, some developers tend to use if(count($arr)) ......
Read more >MyProgrammingLab Starting out with Python Ch.7 - Quizlet
Given that a variable named plist has been defined and refers to a non-empty list, write a statement that associates its first element...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@favph Sure I will, however to require a minimum array length you can use
isArray({ min: 1 })
Seeing the same issue in v6.14.5.