Skip to content

Make form API error handling support string errors#1504

Merged
Crabcyborg merged 1 commit into
masterfrom
make_form_api_error_handling_support_string_errors
Feb 14, 2024
Merged

Make form API error handling support string errors#1504
Crabcyborg merged 1 commit into
masterfrom
make_form_api_error_handling_support_string_errors

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Feb 9, 2024

Related tickets
https://secure.helpscout.net/conversation/2506175920/189635
https://secure.helpscout.net/conversation/2506108172/189628/

It looks like an error for a nulled license works differently.

Instead of the expected $addons['error'] array, it's a string like "Your license has been blocked!".

The "Y" shows up in PHP 7.4.
image

Add more power to your forms, and bring

In PHP 8 it throws a fatal error instead,

Uncaught TypeError: Cannot access offset of type string on string in .../formidable/classes/models/FrmFormApi.php:261
Stack trace:
#0 .../formidable/classes/models/FrmFormApi.php(245): FrmFormApi->get_error_from_response()
#1 .../formidable/classes/models/FrmAddon.php(327): FrmFormApi->error_for_license()
#2 .../formidable/classes/models/FrmAddon.php(317): FrmAddon->show_license_message()
#3 .../class-wp-hook.php(326): FrmAddon->maybe_show_license_message()

The error seems to be causing issues with disconnecting a nulled license. I couldn't figure out where this is being defined though. When I searched the error message, I couldn't find where this message was actually coming from.

Pre-release,
formidable-6.8.1b.zip

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 9, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (cd02373) 29.43% compared to head (9c31e1e) 29.47%.
Report is 3 commits behind head on master.

Files Patch % Lines
classes/models/FrmAddon.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1504      +/-   ##
============================================
+ Coverage     29.43%   29.47%   +0.03%     
- Complexity     7673     7676       +3     
============================================
  Files           115      115              
  Lines         25354    25357       +3     
============================================
+ Hits           7463     7474      +11     
+ Misses        17891    17883       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Crabcyborg Crabcyborg modified the milestone: 6.8.1 Feb 9, 2024
Copy link
Copy Markdown
Contributor

@stephywells stephywells left a comment

Choose a reason for hiding this comment

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

This should be fixed from the Cloudflare end, but we could still merge this if you'd like. It's a nice simple fix.

@Crabcyborg Crabcyborg merged commit 9be31b8 into master Feb 14, 2024
@Crabcyborg Crabcyborg deleted the make_form_api_error_handling_support_string_errors branch February 14, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants