Commit d4901d5
committed
fix(nicknames): handle non-int min/max length settings
Cast the persisted setting to int before handing it to Schema\Str's
minLength/maxLength, and only apply the constraint when the admin has
configured a positive value. An empty field saved from the admin panel
was otherwise stored as '' — triggering a TypeError in PHP's default
weak coercion — and, after the naive cast, coerced to 0, which made
maxLength(0) reject every nickname.
Reveals a gap in Schema\Str: the int-only signature offers no way to
"disable" a length constraint via the condition argument without a
guard at the call site. Keeping the guard local for this RC fix.1 parent 42362b6 commit d4901d5
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
43 | 50 | | |
44 | 51 | | |
45 | 52 | | |
46 | | - | |
47 | | - | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
0 commit comments