• Resolved jnz31

    (@jnz31)


    just found this error in my log
    mod_fcgid: stderr: PHP Warning: Undefined array key “data” in /…/wp-content/plugins/wp-rest-cache/includes/api/class-endpoint-api.php on line 232

    the line goes
    if ( ! empty( $result ) && is_array( $result ) && ( ( is_array( $result['data'] ) && isset( $result['data']['status'] ) && 200 !== (int) $result['data']['status'] ) || 200 !== http_response_code() ) ) {

    i guess this one is causing the issue: is_array( $result[‘data’]
    would be better to determine data via array_key_exists( ‘data’, $result ), no?

    i changed it to
    if ( ! empty( $result ) && is_array( $result ) && ( ( array_key_exists( 'data', $result ) && isset( $result['data']['status'] ) && 200 !== (int) $result['data']['status'] ) || 200 !== http_response_code() ) ) {

Viewing 5 replies - 1 through 5 (of 5 total)
  • Same issue here. The first time the endpoint is loaded, there is a warning, which cause and issue when reading the data.

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @jnz31 and @ubeo

    Thank you for using our plugin!

    Did you guys update to the latest version of our plugin? Because in the latest version we did fix an issue with this specific line and it looks different now than in your example.

    Thread Starter jnz31

    (@jnz31)

    huh?!
    yes, yes, yes, latest of the latest version running.. everything and all is latest, just double-checked aka. 2022.1.0..

    Plugin Author Richard Korthuis

    (@rockfire)

    @jnz31

    My bad, I see it isn’t released in the latest deployment. I am going to look into it…

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @jnz31

    We forgot to update the stable tag for our plugin. I just fixed it and deployed a new version. This version should resolve the warning, please let me know if it is solved for you.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Warning: Undefined array key “data”’ is closed to new replies.