kennym / cf7-to-api

LOOKING FOR MAINTAINER. Wordpress plugin to transmit contact form 7 entries to remote API using POST or GET
https://wordpress.org/plugins/cf7-to-api-basic-auth/
52 stars 30 forks source link

adding "/" each time the form is saved #47

Closed macra closed 2 years ago

macra commented 2 years ago

The plugin has started adding "/"'s in the JSON template every time the form is resaved after changes.

eg; Original template: { "customer_name":"WP Update test", "customer_billing_email":"test@example.com", "customer_email":"tasty@testy.com", "customer_login":"astarisborn", "customer_password":"somepasswordnotused", "customer_dob":"1953-10-14", "customer_street":"100 Devon Street East", } After save 1: { \"customer_name\":\"WP Update test\", \"customer_billing_email\":\"test@example.com\", \"customer_email\":\"tasty@testy.com\", \"customer_login\":\"astarisborn\", \"customer_password\":\"somepasswordnotused\", \"customer_dob\":\"1953-10-14\", \"customer_street\":\"100 Devon Street East\", } After save 2: { \\"customer_name\\":\\"WP Update test\\", \\"customer_billing_email\\":\\"test@example.com\\", \\"customer_email\\":\\"tasty@testy.com\\", \\"customer_login\\":\\"astarisborn\\", \\"customer_password\\":\\"somepasswordnotused\\", \\"customer_dob\\":\\"1953-10-14\\", \\"customer_street\\":\\"100 Devon Street East\\", }

After save 3: { \\\\"customer_name\\\\":\\\\"WP Update test\\\\", \\\\"customer_billing_email\\\\":\\\\"test@example.com\\\\", \\\\"customer_email\\\\":\\\\"tasty@testy.com\\\\", \\\\"customer_login\\\\":\\\\"astarisborn\\\\", \\\\"customer_password\\\\":\\\\"somepasswordnotused\\\\", \\\\"customer_dob\\\\":\\\\"1953-10-14\\\\", \\\\"customer_street\\\\":\\\\"100 Devon Street East\\\\", }

etc.etc.

I'm in a bit of a panic, as an important project involving 4000 customers due to be deployed on Monday, started doing this today!! Help!!

macra commented 2 years ago

Rolled back contact form 7 to Version 5.4.2 which seems to have resolved the issue. Looking at the changelog, I suspect the KSES changes in 5.5 are the culprit. Love this plugin, hopefully you're active enough to resolve this soon.

fixinggenie commented 2 years ago

@macra Found it - https://github.com/takayukister/contact-form-7/blob/7684edc91e5b01b280c770179385c80f5376cbeb/includes/contact-form-functions.php#L226

It might be easier if we just decode and encode the string in the plugin rather than fight with the permissions. https://developer.wordpress.org/reference/functions/wp_specialchars_decode/

studiovanzwet commented 2 years ago

@fixinggenie @macra I'm having the same problem, is there a solution to this issue?

sstraus commented 2 years ago

Any fix for this problem?

studiovanzwet commented 2 years ago

Any fix for this problem?

Downgrading Contact form 7 to V 5.4.2 solved it for now.

Maybe it has something to do with the code in contact-form-7/includes/contact-form-functions.php from line 226. In the picture the right side is V 5.4.2, left V 5.5.2

Schermafbeelding 2021-11-24 om 13 35 25

Whould also like to hear about a fix.

fixinggenie commented 2 years ago

Any fix for this problem?

Downgrading Contact form 7 to V 5.4.2 solved it for now.

Maybe it has something to do with the code in contact-form-7/includes/contact-form-functions.php from line 226. In the picture the right side is V 5.4.2, left V 5.5.2

Schermafbeelding 2021-11-24 om 13 35 25

Whould also like to hear about a fix.

I also downgraded.

I don't know why it isn't seeing the user permissions for unfiltered_html. I checked and my user definitely has it.

sstraus commented 2 years ago

I need more tests, but I've fixed adding stripslashesbefore processing "json_template".

$properties['json_template'] = isset( $_POST["json_template"] ) ? $_POST["json_template"] : '';

and

$qs_cf7_data_template = stripslashes($qs_cf7_data_json_template);

kennym commented 2 years ago

Open a PR, or fork this project, and stop sending me emails. I've created this on a weekend; and now I don't have time to maintain this anymore. Thanks for understanding