• Resolved Stiofan

    (@stiofansisland)


    Since WP 5.3.1 update we have had many reports of our API not working in some cases. I traced this back to Ninja Forms which when active shows PHP warnings in the REST API response, these unfortunately for some users are even showing with WP_DEBUG set to false.

    The root cause is in your plugin file: /includes/MergeTags/Other.php line 54
    $value = wp_kses_post( $value );

    You are not checking if the value is an array first. Any i’m not sure you even need to run this on the API requests?

    To replicate:
    1. Turn on WP_DEBUG to true (not needed in some cases)
    2. Have Ninja Forms installed and active
    3. Visit a API url with a array value eg: /wp-json/?test[]=123

    Result:
    <b>Warning</b>: preg_match() expects parameter 2 to be string, array given

    Please fix and release this ASAP.

    Thanks,

    Stiofan

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Justin McElhaney

    (@jmcelhaney)

    I have added an issue in our system for this: https://git.saturdaydrive.io/_/ninja-forms/ninja-forms/issues/4124

    Thread Starter Stiofan

    (@stiofansisland)

    This is a 2 month old bug that should take 30 seconds to fix, i tried to do a pull on our git system but the develop branch seems several versions out of date.

    We keep adding a filter to our plugin to mitigate this for your current release, thinking this is such a huge bug with such a simple fix that it MUST be in the next release, now every time you do a release it breaks hundreds of our customer’s sites, PLEASE FIX THIS!!!!

    Here is the fix, just please update it! Go, go do it now so its in the next release, it will take you 30 seconds at most…
    /includes/MergeTags/Other.php line 54
    FROM:
    $value = wp_kses_post( $value );
    TO:
    $value = is_array($value) ? wp_kses_post_deep( $value ) : wp_kses_post( $value );

    mookie4a4

    (@mookie4a4)

    Thank you! That code change fixed weeks of PHP warning logs for me

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Breaks any REST API request using array items’ is closed to new replies.