Fix views issue 28#2251
Conversation
WalkthroughThe changes add an early return condition in the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Calling Code
participant Method as sanitize_value
participant Helper as FrmAppHelper::sanitize_value
Caller->>Method: Call sanitize_value(&value)
alt Value is an empty string ('')
Method-->>Caller: Return immediately (empty value)
else Value is not empty
Method->>Helper: Call sanitize_value(value, 'intval')
Helper-->>Method: Return sanitized value
Method-->>Caller: Return sanitized value
end
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
classes/models/fields/FrmFieldUserID.php (1)
137-140: LGTM! Consider enhancing the PHPDoc.The early return logic effectively prevents empty strings from being converted to 0, which aligns with the PR objectives. The code is clean and follows best practices.
Consider updating the PHPDoc to document this behavior:
/** * @since 4.0.04 + * @description Sanitizes the user ID value. Empty strings are preserved, while non-empty values are converted to integers. * * @return void */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
classes/models/fields/FrmFieldUserID.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2251 +/- ##
============================================
+ Coverage 26.94% 26.95% +0.01%
- Complexity 8327 8328 +1
============================================
Files 129 129
Lines 27506 27508 +2
============================================
+ Hits 7412 7416 +4
+ Misses 20094 20092 -2 ☔ View full report in Codecov by Sentry. |
Fixes https://github.com/Strategy11/formidable-views/issues/28
The issue, is that this call to
intvalchanges''to0, which we don't want. Keeping it blank is better.I tested with this basic CSV. My form has a "Text" field, and a User ID field. The User ID field isn't in the CSV, since we're trying to import empty.
250218182012_user-id-test_formidable_entries.csv