Skip to content

Fix: Integer route keys in tag bindings crashed requests (1.5.4) - #31

Merged
Moritz Mazetti (Radiergummi) merged 1 commit into
1.xfrom
fix/1.x-integer-route-key-tags
Oct 26, 2026
Merged

Moritz Mazetti (Radiergummi) merged 1 commit into
1.xfrom
fix/1.x-integer-route-key-tags

Conversation

@Radiergummi

Copy link
Copy Markdown
Member

Summary

Fixes a crash on the v1 line: a cache tag binding to a model with an integer route key (e.g. response_cache:users,user:{user} with a standard Eloquent model) passed an int to str_replace() under strict_types. Every request to such a route failed with:

TypeError: str_replace(): Argument #2 ($replace) must be of type array|string, int given

The fix casts the resolved value to a string. The bug was found while testing v2 (#30) against a fresh Laravel app, and is fixed there too.

This targets the new 1.x maintenance branch, created from the 1.5.3 tag, and is meant for release as 1.5.4.

Test plan

  • New feature test resolves bound models with integer keys in tags reproduces the TypeError, and passes with the fix.
  • vendor/bin/pest: 15 passing.
  • PHPStan (38 errors) and Pint report the same findings as on 1.5.3 itself. Nothing new was introduced, and they are left alone to keep the patch minimal. 1.x has no CI workflow; it was added on master after 1.5.3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GGNGyJLoFTM5C474gZPW5q

A tag binding to a model with an integer route key, like user:{user}, passed
an int to str_replace() under strict_types, so every request to the route
failed with a TypeError.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGNGyJLoFTM5C474gZPW5q
@Radiergummi
Moritz Mazetti (Radiergummi) merged commit 4231e7d into 1.x Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant