fix: safely interpolate logger context values#10384
Open
michalsn wants to merge 2 commits into
Open
Conversation
paulbalandan
reviewed
Jul 7, 2026
memleakd
approved these changes
Jul 7, 2026
Co-authored-by: John Paul E Balandan <paulbalandan@gmail.com>
paulbalandan
approved these changes
Jul 7, 2026
5 tasks
|
The safe interpolation behavior should be tested with the full PSR-3 variety: arrays, scalar values, |
Member
Author
|
I believe we already covered a fair number of cases, and the previous behavior when it comes to the strings has not changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes logger message interpolation so arbitrary PSR-3 context values do not raise PHP warnings or errors when used as placeholders.
Context values are now converted to safe strings before being passed to
strtr(). Arrays and Entities are rendered withprint_r()to match the logger's existing output style,Stringablevalues such asTimecontinue to use their string representation, and non-stringable objects/resources fall back to safe descriptive placeholders.Reported in: https://forum.codeigniter.com/showthread.php?tid=94242
Ref: https://www.php-fig.org/psr/psr-3/
Checklist: