You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Critical Bug Fixes:
- Fix ObjectValidator null property handling - isset() was excluding null properties from result objects
- ObjectValidator now correctly includes all validated properties, even when null
- Maintains consistency with AssociativeValidator behavior
BREAKING CHANGE - Form-Safe Coercion:
- IntValidator::coerce(): Empty strings ('') now convert to null instead of 0
- FloatValidator::coerce(): Empty strings ('') now convert to null instead of 0.0
- BoolValidator::coerce(): Empty strings ('') now convert to null instead of validation failure
- Prevents dangerous zero defaults in form fields (bank balances, quantities, pricing)
- Migration: Use explicit ->default(0) if you need zero defaults for empty form fields
Enhanced Test Coverage:
- Added BoolValidator test suite with comprehensive boolean validation and coercion tests
- Updated IntValidator and FloatValidator tests for new empty string → null behavior
- Added ObjectValidator test for null property inclusion
- Total: 110 tests with 278 assertions
Comprehensive Documentation Updates:
- Added detailed form-safety rationale in Core Concepts guide
- Enhanced Numeric Validation guide with real-world safety examples
- Updated Basic Usage guide with form-safety notes and cross-references
- Updated README.md coercion examples to show null instead of dangerous zeros
- Updated CHANGELOG.md, ROADMAP.md, AGENTS.md, and IDEAS.md to reflect changes
This release prioritizes real-world application safety over PHP's default type casting behavior.
> **Form Safety Note**: Empty strings convert to `null` (not `0`/`0.0`/`false`) to prevent dangerous defaults in form handling. See [Core Concepts - Form-Safe Empty String Handling](core-concepts.md#form-safe-empty-string-handling) for details.
0 commit comments