The Wire · Showcase
LARAVEL FIXES NUMBER UTILITY CRASH ON INFINITE VALUES
By RepoJournal · Filed · About Laravel
Number::fileSize() was spinning into infinity on INF and NAN inputs, producing nonsensical output like "∞ YB" - a fix just landed in 13.x.
The Number::fileSize() method had a critical flaw: when passed non-finite values (INF, -INF, or NAN), the method would loop through every unit in the scale until memory exhaustion because dividing infinity by 1024 still yields infinity [1]. This mirrors a similar bug that was fixed in Number::summarize() just days ago [2], which guards against non-finite inputs before iteration. The new PR applies the same is_finite() guard to fileSize(), stopping the runaway loop immediately and returning a sensible fallback. Framework maintenance also bumped GitHub Actions dependencies [3] to keep CI pipelines current, a routine hygiene task that doesn't affect production code.
One email a day. Unsubscribe in one click.
Keep up with Laravel in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Monitor 13.x for the Number::fileSize() fix merge laravel/framework [monitor]
- → If you use Number::fileSize() with user input, add validation to reject non-finite values laravel/framework [plan]
References
- [1] [13.x] Fix Number::fileSize crashing on INF/NAN inputs ↗ laravel/framework
- [2] [13.x] Fix Number::fileSize returning wrong unit suffix for non-finite inputs (#60625) laravel/framework
- [3] Bump the github-actions group with 2 updates ↗ laravel/framework