Undefined index PHP Notice
-
Dear Plugin Developers!
First of all, thanks for this plugin, it’s really cool!
Since the last update (v. 2022.1.0) your plugin generates the following log message for my site:
PHP Notice: Undefined index: data in wp-content/plugins/wp-rest-cache/includes/api/class-endpoint-api.php on line 232
The mentioned line looks like this:
if ( ! empty( $result ) && is_array( $result ) && ( ( is_array( $result['data'] ) && isset( $result['data']['status'] ) && 200 !== (int) $result['data']['status'] ) || 200 !== http_response_code() ) ) {
With a small modification, the notice goes away:
if ( ! empty( $result ) && is_array( $result ) && ( ( isset($result['data']) && is_array( $result['data'] ) && isset( $result['data']['status'] ) && 200 !== (int) $result['data']['status'] ) || 200 !== http_response_code() ) ) {
I’m happy to create a PR, if you have a git repo.
Cheers: Kolos
- The topic ‘Undefined index PHP Notice’ is closed to new replies.