Skip to content

Add null check in get_field_value_for_new_entry - #3570

Merged
Crabcyborg merged 1 commit into
masterfrom
add_null_check
Oct 13, 2026
Merged

Crabcyborg merged 1 commit into
masterfrom
add_null_check

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #3332.

We don't typically type cast null, but prefer checks instead.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: Strategy11/formidable-forms/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4180c53f-7488-4c71-b1b5-48e49e19cbdd
📥 Commits

Reviewing files that changed from the base of the PR and between ce07629 and 592d879.

📒 Files selected for processing: 1
  • classes/helpers/FrmEntriesHelper.php
 ______________________________________________________
< This code is a locked door with the key taped to it. >
 ------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in ce07629...592d879 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Oct 13, 2026 6:13p.m. Review ↗
JavaScript Oct 13, 2026 6:13p.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.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 13, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. The fix does what it says and changes nothing else.

Bug reproduced, before and after (local WP Playground, PHP 8.5.10, E_ALL + display_errors). I made a form with four fields whose default_value is NULL in the DB (text, email, textarea, select) and ran FrmFormsController::get_form_shortcode() on it.

  • Base (518b4aeb): Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in FrmEntriesHelper.php on line 137.
  • This PR (592d879c): no deprecation. The output HTML is identical to base apart from the deprecation's own <br /> and a random honeypot id.

Old vs new behavior, every input type (php run against copies of both versions): null, '', '0', 'Hello', 'He said "hi"', ['a','b'], [] all return the same value as before. The only difference is that null no longer raises the deprecation. The array branch's ?? '' is a no-op, so nothing is lost there.

CI. Most analysis jobs are skipped on this draft; Psalm, typos and the third-party checks pass. I did not run PHPUnit locally. I read the diff by hand rather than running code-review/security-review, since it is three lines in one function with no security surface. This is the only str_replace() on a possibly-null default in that function, so there is no sibling instance to patch.

Not exercised: no browser or screenshot check, because there is no visual change (the HTML output is identical). Submitting the form and the posted-value path were not run; they are unchanged by this diff.

No findings.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Oct 13, 2026
@Crabcyborg
Crabcyborg marked this pull request as ready for review October 13, 2026 18:50
@Crabcyborg
Crabcyborg merged commit eab4529 into master Oct 13, 2026
59 checks passed
@Crabcyborg
Crabcyborg deleted the add_null_check branch October 13, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant