Skip to content

Fix Age header value type to string for PSR compliance - #218

Merged
Kevinrob merged 2 commits into
Kevinrob:masterfrom
ievgeniiskliarenko:fix-psr-deprecation
Jun 10, 2026
Merged

Kevinrob merged 2 commits into
Kevinrob:masterfrom
ievgeniiskliarenko:fix-psr-deprecation

Conversation

@ievgeniiskliarenko

@ievgeniiskliarenko ievgeniiskliarenko commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

guzzlehttp/psr7 2.11.0 deprecated passing non-string values to MessageInterface::withHeader(),
emitting E_USER_DEPRECATED via trigger_deprecation().

Stacktrace:
MessageTrait.php: trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to M...', 'int')
CacheEntry.php: Response->withHeader('Age', 0) ← int, not string

Fix

Cast getAge() return value to string before passing to withHeader().

Compatibility

  • Fixes psr7 2.11+ deprecation
  • Fully backwards compatible with older psr7 versions

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request casts the 'Age' header value to a string in CacheEntry.php and adds a test to verify this behavior. The review feedback points out a PSR-12 formatting issue regarding the space after the casting operator, and notes that the test assertion is redundant because getHeaderLine() always returns a string; it suggests asserting on the array returned by getHeader() instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/CacheEntry.php Outdated
Comment thread tests/ResponseAgeTest.php Outdated
@ievgeniiskliarenko
ievgeniiskliarenko marked this pull request as ready for review June 2, 2026 13:36

@Kevinrob Kevinrob left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kevinrob
Kevinrob merged commit 78dd5a1 into Kevinrob:master Jun 10, 2026
8 checks passed
@Kevinrob

Copy link
Copy Markdown
Owner

Available in 8.0.0-RC2

@ievgeniiskliarenko
ievgeniiskliarenko deleted the fix-psr-deprecation branch June 10, 2026 06:46
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.

2 participants