Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Conversation

@claudiosanches
Copy link
Contributor

@claudiosanches claudiosanches commented Jun 2, 2020

It fixes a notice caused by the missing items param required for 'array' types.
Seems like now there's some new items to fix since #4377

[14-May-2020 18:15:39 UTC] PHP Notice: Undefined index: items in /var/www/woo/wp-includes/rest-api.php on line 1246

Fixes #4280

Detailed test instructions:

  • Turn on your PHP logger, you can enable the WP logger by introducing the code bellow to your wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
  • Go to the WC Admin Dashboard in /wp-admin/admin.php?page=wc-admin
  • Now check the wp-content/debug.log, you should see messages like:

PHP Notice: Undefined index: items in /var/www/woo/wp-includes/rest-api.php on line 1246

  • Finally apply this patch and reload the dashboard page, check that all notices are gone now.

Note: Tested with WooCommerce 4.1.x and 4.2.

Changelog Note:

Fix: REST API collections schema.

@claudiosanches claudiosanches added the needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. label Jun 2, 2020
@claudiosanches claudiosanches requested a review from timmyc June 2, 2020 21:41
@psealock psealock added [Status] Needs Review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jun 5, 2020
@peterfabian
Copy link
Contributor

Hi @timmyc , as mentioned in Slack, can we please try to get this into 4.3? It's polluting the logs unnecessarily. Thanks!

Copy link
Contributor

@timmyc timmyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix and the detailed test instructions @claudiosanches 🙌

@timmyc timmyc merged commit 2e68f53 into master Jun 9, 2020
@timmyc timmyc deleted the fix/incorrect-collection-params branch June 9, 2020 22:35
@nsandrew
Copy link

Do I understand the history correctly that this will be fully fixed in 4.3?

#4280 makes it seem like this was fixed in 4.1, but I am still seeing it in 4.2 with a different line number:

[16-Jun-2020 12:03:52 UTC] PHP Notice: Undefined index: items in /nas/content/live/vinga/wp-includes/rest-api.php on line 1251

And it's in groups / batches of other seemingly related notices over and over:

[16-Jun-2020 12:03:52 UTC] PHP Notice: Undefined index: items in /nas/content/live/vinga/wp-includes/rest-api.php on line 1251
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1226
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1240
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1258
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1298
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1314
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1319
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1324
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1329
[16-Jun-2020 12:03:52 UTC] PHP Notice: Trying to access array offset on value of type null in /nas/content/live/vinga/wp-includes/rest-api.php on line 1356

Will all those also be fixed by this patch?

@claudiosanches
Copy link
Contributor Author

@nsandrew everything should be fixed on 4.3.

@nsandrew
Copy link

awesome @claudiosanches many thanks!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[4.1 RC]: notices are logged using analytics

6 participants