fix: handle null code in frontier_decode_template for PHP 8.1+ - #7579
fix: handle null code in frontier_decode_template for PHP 8.1+#7579faisalahammad wants to merge 2 commits into
Conversation
The frontier_decode_template() function receives from WordPress shortcode API callbacks, which can pass null when no closing tag is present. base64_decode(null) returns false on PHP 8+, which then gets passed to str_replace() as the parameter, triggering: Deprecated: str_replace(): Passing null to parameter pods-framework#3 is deprecated Cast both the input and the return value to string so that null/false produces an empty string instead, which downstream str_replace() handles safely as a no-op. Fixes pods-framework#7249
PR Summary
|
|
AI disclosure: this PR was written with Claude Opus 5 assistance, reviewed and tested by me. |
Review: the change is fine, but it isn't what #7249 reportedIssue #7249 names That function already has the fix on function frontier_prefilter_template( $code, $template, $pod ) {
$code = (string) $code;(line 698, added by commit The change itself
One small correction: the PR body says SuggestionKeep the one-liner if you want the hardening, but drop Disclosure: this review was produced with AI assistance and verified against the branch code before posting. |
Description
The
frontier_decode_template()function receives $code from WordPress shortcode API callbacks, which can pass null when no closing tag is present.base64_decode(null)returns false on PHP 8+, which then gets passed tostr_replace()as the $subject parameter, triggering:Deprecated: str_replace(): Passing null to parameter #3 is deprecatedCast both the input and the return value to string so that null/false produces an empty string instead, which downstream
str_replace()handles safely as a no-op.Related GitHub issue(s)
Fixes #7249
Testing instructions
[pods field="my_field"]shortcodeWP_DEBUG=trueScreenshots / screencast
N/A
Changelog text for these changes
Bug: Fixed PHP 8.1+ deprecation warnings when using Pods shortcodes inside Pods Templates. #7249 (@faisalahammad)
PR checklist