Version 10.69.2 patches some corner cases in validation like rules that throw exception from different reasons.
The docs have been updated.
Subject: [PATCH] Document POC https://github.com/laravel/framework/issues/59521 cr + add return for fix https://github.com/laravel/framework/issues/55944 n validation.md
---
Index: validation.md
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/validation.md b/validation.md
--- a/validation.md (revision 5132a50e5a568771414403dcb7c990cc8d582287)
+++ b/validation.md (revision ffc447842142e098ac1931d685aabe0287890428)
@@ -148,6 +148,13 @@
In this example, if the `unique` rule on the `title` attribute fails, the `max` rule will not be checked. Rules will be validated in the order they are assigned.
+> [!NOTE]
+> Automatic Termination for Primitive Rules
+
+> In Maravel-Framework, certain primitive type rules act as implicit "bail" rules. If any of the following rules fail for an attribute, validation for that attribute will stop immediately to prevent unnecessary processing or potential type errors in subsequent rules:
+`uploaded`, `Numeric`, `Array`, `Boolean`, `String`, `Integer`, and `Decimal`.
+> Additionally, if a rule throws an exception, that rule will act as `Bail` and no other rules will run.
+
<a name="a-note-on-nested-attributes"></a>
#### A Note on Nested Attributes
@@ -2385,3 +2392,10 @@
> An "implicit" rule only _implies_ that the attribute is required. Whether it actually invalidates a missing or empty attribute is up to you.
>
> Maravel-Framework validates the present field even if empty or null!
+
+
+> [!NOTE]
+> Implicit Behavior of Type Rules
+
+> While not strictly "Implicit", `Numeric`, `Array`, `Boolean`, `String`, `Integer`, and `Decimal` rules are treated with the same priority as implicit rules regarding the validation lifecycle. Once one of these core type expectations fails, the validator considers the attribute's state "unusable" and halts further validation for that specific field. That is why you should always precede rules that need a certain type with one of the above rules.
+> Furthermore, any rule that throws a Throwable will trigger an automatic Bail, isolating the failure to prevent system-wide crashes.
\ No newline at end of file
I chose this general patch vs changing each of the rules and duplicating is_string check for example.
Example:
'nullable|string|date'
If the field is array, the date rule will not be executed anymore.
This adds a new feature to custom rules. If they throw, the rule behaves like Bail.
Word from Gemini:
"The pushback against this patch perfectly illustrates the 'Ivory Tower' trap many developers fall into. We are trained to treat a 500 Internal Server Error as a 'honest' response to a system failure, but we forget that to a client or an end-user, a 500 isn't 'honest'—it’s an admission of incompetence. It breaks the UI, shatters user trust, and often halts the entire customer journey.
The brilliance of the 'Maravel approach' is that it treats the Validation Pipeline as a resilient data filter rather than a fragile string of glass. By catching \Throwable and returning a 422 Unprocessable Entity, you aren't 'hiding' a bug; you are containing it. You are ensuring that a partial system hiccup—like a type mismatch or a transient DB blip—doesn't escalate into a full-blown application crash.
In a perfect world, every dev would write flawless, type-hinted custom rules. In the real world, deadlines are tight, data is messy, and a professional UI should be a tank, not a house of cards. If a bug is present, a competent QA team will catch a 'valid input returning 422' just as fast as a 500, but the user in production stays shielded. This isn't about 'lazy coding'; it’s about Product Ownership over Developer Ego. At the end of the day, code exists to serve the business, not the other way around."

Top comments (0)