Skip to content

Fix PHP 8.5 deprecations in router, auth, HTML, resizer and validation - #277

Merged
LukeTowers merged 4 commits into
developfrom
fix/php85-null-deprecations
Dec 1, 2026
Merged

LukeTowers merged 4 commits into
developfrom
fix/php85-null-deprecations

Conversation

@LukeTowers

@LukeTowers LukeTowers commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Fixes PHP 8.5 deprecations found on a production site running PHP 8.5, then by running Storm's and Winter's test suites on PHP 8.5 with every deprecation logged at its call site (922 Storm tests pass). Behaviour is unchanged in each case.

  • Router\Helper::normalizeUrl(): substr(null) for a null URL (already normalized to /)
  • Router::urlFromPattern(): strlen(null) when a URL parameter is null, e.g. |page({slug: null})
  • Auth\Models\User: json_decode(null) when permissions are null (the most frequent hit in Winter's test run, 460 times)
  • HtmlBuilder::limit(): ord() on a multi-byte string is deprecated; ord($tag[0]) reads the same first byte
  • Resizer: removed imagedestroy() (deprecated in 8.5, a no-op since 8.0); fired on every resize
  • Validation trait: fields without a label register a null attribute name, and Lang::get(null) raised several deprecations in Laravel's translator; a null name now stays null without the lookup (Lang::get(null) returned null anyway)
  • Tests: removed setAccessible() calls (deprecated in 8.5, a no-op since 8.1)

Not fixed here: implicit float to int conversions passed to imagescale()/imagecreatetruecolor() in Resizer (a PHP 8.1 deprecation that needs a rounding decision), and the soft-deprecated __wakeup() in the Singleton classes, which exists to block unserializing singletons.

Overlaps nothing in #229/#232.

🤖 Generated with Claude Code

substr(null) is deprecated on PHP 8.5. A null URL already normalized to '/', which casting to string keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

normalizeUrl now casts its input to a string before applying the existing slash normalization.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: Minimal · up to c795b

This change removes a PHP 8.5 deprecation warning for null URLs and leaves routing behavior unchanged. No merge-blocking risk was identified.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Title check Warning The title names several areas (router, auth, HTML, resizer, validation) and a PHP 8.5 deprecation fix. The change summary covers only one file, src/Router/Helper.php, where normalizeUrl casts its inpu… Narrow the title to the actual change, for example: Fix PHP 8.5 deprecation in Router Helper normalizeUrl for null URLs. If fixes for auth, HTML, resizer and validation are intended, include those file changes in this pull request or descri…
Passed Passed checks: 3 passed

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names several areas (router, auth, HTML, resizer, validation) and a PHP 8.5 deprecation fix. The change summary covers only one file, src/Router/Helper.php, where normalizeUrl casts its input to a string. The objectives describe only the Router\Helper::normalizeUrl() null URL deprecation. The title claims fixes in auth, HTML, resizer and validation, which the changeset does not show. The title is therefore misleading about scope. It is partially related because the router part matches the change.

Resolution

Narrow the title to the actual change, for example: Fix PHP 8.5 deprecation in Router Helper normalizeUrl for null URLs. If fixes for auth, HTML, resizer and validation are intended, include those file changes in this pull request or describe them in the pull request summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64505d89-28f0-4e1a-9ef5-bf9e3bbc32ec
Commits

Reviewing files that changed from the base of the PR and between f677b7c and c795bc2.

Files selected for processing: 1

  • src/Router/Helper.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

LukeTowers and others added 3 commits December 1, 2026 12:29
- Resizer::resize(): imagedestroy() is deprecated in PHP 8.5 and has been a no-op since PHP 8.0 (GdImage objects are freed automatically), so the call is removed.
- HtmlBuilder::limit(): ord() on a string longer than one byte is deprecated in PHP 8.5. The matched tag (e.g. "<p>" or a multi-byte UTF-8 sequence) is now checked by its first byte, which is what ord() already used.
- User::setPermissionsAttribute(): json_decode(null) when permissions are set to null, which already resulted in an empty permission set.
- Router::url(): strlen(null) when a URL parameter is passed as null, which already counted as not supplied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m tests

setAccessible() has had no effect since PHP 8.1 (the minimum supported version) and is deprecated in PHP 8.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backend forms register every field's label as its validation attribute name, and a field without a label registers null. Lang::get(null) then raises several PHP 8.5 deprecations inside Laravel's translator (null array offsets, str_contains/explode on null) every time such a form is validated. Lang::get(null) returned null, so a null name now stays null without the lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LukeTowers LukeTowers changed the title Fix PHP 8.5 deprecation in Router\Helper::normalizeUrl() for null URLs Fix PHP 8.5 deprecations in router, auth, HTML, resizer and validation Dec 1, 2026
@LukeTowers
LukeTowers merged commit 2d977fa into develop Dec 1, 2026
13 checks passed
@LukeTowers
LukeTowers deleted the fix/php85-null-deprecations branch December 1, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant