fix: normalize nullable notification text - #816
Open
somethingwithproof wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the thold_str_replace() notification-template helper to safely accept a nullable subject (notification text) without relying on PHP 8.1’s deprecated null-to-string coercion, and adds a regression test plus minimal documentation updates.
Changes:
- Allow
thold_str_replace()’s$subjectparameter to be nullable and normalizenullto''before callingstr_replace(). - Add a unit regression that asserts the nullable-subject boundary emits no
E_DEPRECATED. - Document the nullable template-field behavior in README and add a CHANGELOG entry for issue #814.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
thold_functions.php |
Makes thold_str_replace() accept ?string $subject and normalizes null to empty string to avoid deprecated coercion. |
tests/Unit/TholdStrReplaceTest.php |
Adds a regression test capturing/forbidding E_DEPRECATED when the subject is null. |
README.md |
Documents that unset notification template fields are treated as empty text. |
CHANGELOG.md |
Records the fix for issue #814. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Notification text columns can be NULL, and PHP 8 makes passing NULL into the string functions a deprecation rather than an empty string.
Normalises the values at read time.
Closes #814.