Fix string offset access of string issue#2170
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
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: 1
🧹 Outside diff range and nitpick comments (1)
classes/helpers/FrmFormsHelper.php (1)
Line range hint
2146-2146: Ensure strict comparison instrposusageThe use of
strposwithout strict comparison may lead to unexpected behavior when the substring is at the beginning of the string (position 0). Sincestrposreturns0in such cases, which is evaluated asfalse, the condition will not work as intended. To accurately detect the presence of the substring, use!== falsein the comparison.Apply this diff to fix the issue:
-$has_show_upgrade_class = isset( $field_type['icon'] ) && strpos( $field_type['icon'], ' frm_show_upgrade' ); +$has_show_upgrade_class = isset( $field_type['icon'] ) && strpos( $field_type['icon'], ' frm_show_upgrade' ) !== false;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
classes/helpers/FrmFieldsHelper.php(1 hunks)classes/helpers/FrmFormsHelper.php(2 hunks)
🔇 Additional comments (2)
classes/helpers/FrmFormsHelper.php (2)
Line range hint 219-228: get_field_link_name method implemented correctly
The new get_field_link_name method properly handles input that can be either an array or a string, ensuring the correct field label is returned in both cases. This addition enhances code readability and reusability.
Line range hint 235-244: get_field_link_icon method improves error handling
The get_field_link_icon method checks for the existence of the 'icon' key in the $field_type array and assigns a default icon if it's not present. This prevents potential undefined index errors and aligns with best practices for handling array keys.
Related ticket https://secure.helpscout.net/conversation/2784288062/217416
Pre-release
formidable-6.16.3b.zip