Repository navigation
Conversation
…r_new_entry A field without a default value has a null default_value, and a field type whose value is not posted back leaves it null as well. Passing that null to str_replace() as the subject is deprecated in PHP 8.1+ and logs: Deprecated: str_replace(): Passing null to parameter Strategy11#3 ($subject) of type array|string is deprecated in classes/helpers/FrmEntriesHelper.php on line 132 It is visible on any form that has such a field while WP_DEBUG_DISPLAY is on. Casting before the call keeps the empty string the caller already received, so no behaviour changes: the same value is returned for null, an empty string, a plain string, and a string containing a quote.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe entry helper now casts non-array field values to strings before escaping quotes. Null values continue to produce an empty string without PHP 8.1+ warnings. ChangesEntry value handling
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The cast removes the PHP deprecation while preserving the intended empty-string and quote-escaping behavior. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Sep 12, 2026 3:58p.m. | Review ↗ | |
| JavaScript | Sep 12, 2026 3:58p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
What this fixes
FrmEntriesHelper::get_field_value_for_new_entry()passes a possibly-null value tostr_replace(), which emits a deprecation notice on PHP 8.1+:$new_valuestarts as$field->default_value, which isnullfor a field that has no default value. It staysnullwhen the field's value is not posted back either, and the! is_array()branch then hands thatnullstraight tostr_replace().It shows up on the front end of any form containing such a field whenever
WP_DEBUG_DISPLAYis on.The change
The cast rather than an early
return $new_valueis deliberate: the caller assigns the result to$field_array['value'], and PHP already coercednullto''here, so casting preserves the existing behaviour exactly instead of introducingnullwhere callers expect a string.Verification
Checked with
error_reporting( E_ALL )that the new expression returns the identical value to the old one for every input that reaches this branch:null(no default value)''+ deprecation'''''''''Hello''Hello''Hello''He said "hi"''He said "hi"''He said "hi"'0'0''0''0''0''0'Reported from a WordPress 7.1 / PHP 8.3 environment with Formidable 6.35; the same line is present on
mastertoday.Summary by CodeRabbit