requiredWith / requiredWithout
Conditional validation based on other fields (#267)
Valicomb is a modernized fork of vlucas/valitron. This page documents known issues from the original library that have been fixed in Valicomb.
These issues caused incorrect validation results or PHP errors in the original library.
Fixed Valitron #368
Problem: Empty strings incorrectly passed the integer validation rule.
// In Valitron - BUG: This passes validation$v = new Validator(['num' => '']);$v->rule('integer', 'num');$v->validate(); // true (incorrect!)Fix: Valicomb uses filter_var() with FILTER_VALIDATE_INT which correctly rejects empty strings.
// In Valicomb - This correctly fails$v = new Validator(['num' => '']);$v->rule('integer', 'num');$v->validate(); // false (correct!)Fixed Valitron #356
Problem: Empty strings incorrectly passed lengthMin and lengthBetween validation rules.
// In Valitron - BUG: This passes validation$v = new Validator(['text' => '']);$v->rule('lengthMin', 'text', 1);$v->validate(); // true (incorrect!)Fix: Valicomb correctly calculates string length and compares against the minimum.
// In Valicomb - This correctly fails$v = new Validator(['text' => '']);$v->rule('lengthMin', 'text', 1);$v->validate(); // false (correct!)Fixed Valitron #260
Problem: Empty arrays incorrectly passed the required validation rule.
// In Valitron - BUG: This passes validation$v = new Validator(['items' => []]);$v->rule('required', 'items');$v->validate(); // true (incorrect!)Fix: Valicomb now treats empty arrays as empty values that fail required validation.
// In Valicomb - This correctly fails$v = new Validator(['items' => []]);$v->rule('required', 'items');$v->validate(); // false (correct!)
// Non-empty arrays still pass$v = new Validator(['items' => ['apple', 'banana']]);$v->rule('required', 'items');$v->validate(); // true (correct!)Fixed Valitron #381 #370 #357
Problem: PHP 8.1+ throws deprecation warnings when null is passed to strtotime().
// In Valitron - PHP 8.1+ deprecation warningDeprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecatedFix: Valicomb validates input types before calling strtotime() and uses explicit string casts.
// In Valicomb - No deprecation warnings// All strtotime() calls are protected with type checksif (!is_string($value)) { return false;}// Or use explicit casting$timestamp = strtotime((string)$value);Fixed Valitron #182
Problem: Using array validation rules on non-array values caused PHP warnings.
// In Valitron - BUG: PHP Warning$v = new Validator(['field' => 'not an array']);$v->rule('array', 'field');$v->validate(); // Warning: Invalid argument supplied for foreach()Fix: Valicomb checks input types before performing array operations.
// In Valicomb - Clean failure, no warnings$v = new Validator(['field' => 'not an array']);$v->rule('array', 'field');$v->validate(); // false (no warnings!)Fixed Valitron #70
Problem: The value 0 was sometimes incorrectly handled in min/max validation due to PHP’s type juggling.
Fix: Valicomb uses is_numeric() checks and high-precision bccomp() for numeric comparisons.
Fixed Valitron #273
Problem: URL validation threw errors when the input was an object instead of a string.
Fix: Valicomb validates input types before processing, returning false for non-string values.
These features were requested in Valitron issues and have been implemented in Valicomb.
requiredWith / requiredWithout
Conditional validation based on other fields (#267)
IPv4 / IPv6 / ASCII
Network and character validation rules (#261)
startsWith / endsWith
String prefix and suffix validation (#170)
arrayHasKeys
Validate required array keys (#280)
Valicomb includes updated and corrected translations for all 33 supported languages, addressing issues reported in:
| Issue | Description | Status |
|---|---|---|
| #368 | Empty strings pass integer validation | Fixed |
| #356 | Empty strings pass length validation | Fixed |
| #260 | Empty arrays pass required validation | Fixed |
| #381, #370, #357 | PHP 8.1+ strtotime deprecation | Fixed |
| #182 | Array validation causes PHP warnings | Fixed |
| #273 | URL validation with objects | Fixed |
| #70 | Min validation with zero | Fixed |
| #267 | requiredWith/requiredWithout rules | Added |
| #261 | IPv4/IPv6/ASCII rules | Added |
| #170 | startsWith/endsWith rules | Added |
| #280 | arrayHasKeys rule | Added |
Found a bug or have a feature request?