Support » Plugin: Contact Form 7 » Rest update bug

  • Resolved felipon

    (@felipon)


    Hello in ‘includes\contact-form-functions.php’ is this function:

    
    function wpcf7_sanitize_mail( $input, $defaults = array() ) {
    	$input = wp_parse_args( $input, array(
    		'active' => false,
    		'subject' => '',
    		'sender' => '',
    		'recipient' => '',
    		'body' => '',
    		'additional_headers' => '',
    		'attachments' => '',
    		'use_html' => false,
    		'exclude_blank' => false,
    	) );
    
    	$input = wp_parse_args( $input, $defaults );
    

    wich ignores the ‘$defaults” parameter, because the first ‘wp_parse_args()’ already sets empty default values for $input.
    the second time $input is assigned with wp_parse_args() nothing is set.

    previus old version of the code works correctly:
    http://hookr.io/plugins/contact-form-7/4.7/functions/wpcf7_sanitize_mail/
    – first wp_parse_args() $defaults, and second the $input.

    because of this the rest function wpcf7_rest_update_contact_form() in ‘includes/rest-api.php’ doesn’t work correctly, if we dont send the mail property this will be update empty either with post or patch.

    thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    because of this the rest function wpcf7_rest_update_contact_form() in ‘includes/rest-api.php’ doesn’t work correctly, if we dont send the mail property this will be update empty either with post or patch.

    Could you tell me in what cases do you see this scenario? Sending no mail property means you want to override the properties with empty values, doesn’t it?

    Thread Starter felipon

    (@felipon)

    In the case you want to update only the form template or the messages for example, if mail property isn’t send, then is overwritten with blank values, situation that did not happen before, i could send a patch request for only one property.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thanks. The next release includes a fix for that, but you are still advised to specify all the properties when saving a contact form.

    Thread Starter felipon

    (@felipon)

    thanks you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Rest update bug’ is closed to new replies.