Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1046472
D86.id220.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 28, 7:24 PM
Size
739 B
Mime Type
text/x-diff
Expires
Sun, Jun 29, 7:24 PM (12 h, 46 m)
Engine
blob
Format
Raw Data
Handle
676519
Attached To
D86: INP-1438 - Don't validate form field value length, when it's empty
D86.id220.diff
View Options
Index: core/kernel/utility/validator.php
===================================================================
--- core/kernel/utility/validator.php
+++ core/kernel/utility/validator.php
@@ -264,13 +264,15 @@
return false;
}
- // validate string
- if ( isset($params['max_len']) ) {
- $res = $res && mb_strlen($val) <= $params['max_len'];
- }
+ if ( strlen($val) > 0 ) {
+ // Validate string.
+ if ( isset($params['max_len']) ) {
+ $res = $res && mb_strlen($val) <= $params['max_len'];
+ }
- if ( isset($params['min_len']) ) {
- $res = $res && mb_strlen($val) >= $params['min_len'];
+ if ( isset($params['min_len']) ) {
+ $res = $res && mb_strlen($val) >= $params['min_len'];
+ }
}
if ( !$res ) {
Event Timeline
Log In to Comment