Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F823745
D86.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
Mon, Mar 10, 1:48 PM
Size
784 B
Mime Type
text/x-diff
Expires
Tue, Mar 11, 1:48 PM (1 h, 36 m)
Engine
blob
Format
Raw Data
Handle
585830
Attached To
D86: INP-1438 - Don't validate form field value length, when it's empty
D86.diff
View Options
Index: branches/5.2.x/core/kernel/utility/validator.php
===================================================================
--- branches/5.2.x/core/kernel/utility/validator.php
+++ branches/5.2.x/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