Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Undefined index: id in Loader.php:1019 #5631

Closed
BrianHenryIE opened this issue Nov 14, 2020 · 8 comments
Closed

Undefined index: id in Loader.php:1019 #5631

BrianHenryIE opened this issue Nov 14, 2020 · 8 comments
Assignees
Labels
status: stale The issue/PR is stale type: bug The issue is a confirmed bug.

Comments

@BrianHenryIE
Copy link

BrianHenryIE commented Nov 14, 2020

Describe the bug

Our logs are full of lots of:

PHP Notice:  Undefined index: id in /path/to/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/Loader.php on line 1019
PHP Notice:  Undefined index: value in /path/to/wp-content/plugins/woocommerce/packages/woocommerce-admin/src/Loader.php on line 1019

where Loader.php is preloading options.

I added in some extra logging:

error_log((new Exception())->getTraceAsString());

#0 /path/to/wp-includes/class-wp-hook.php(287): Automattic\WooCommerce\Admin\Loader::add_component_settings(Array)
#1 /path/to/wp-includes/plugin.php(206): WP_Hook->apply_filters(Array, Array)
#2 /path/to/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Assets/AssetDataRegistry.php(131): apply_filters('woocommerce_sha...', Array)
#3 /path/to/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/Assets/AssetDataRegistry.php(222): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->initialize_core_data()
#4 /path/to/wp-includes/class-wp-hook.php(287): Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry->enqueue_asset_data('')
#5 /path/to/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#6 /path/to/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#7 /path/to/wp-admin/admin-footer.php(95): do_action('admin_print_foo...')
#8 /path/to/wp-admin/edit.php(464): require_once('/home/customer/...')
#9 {main}

error_log( $group );

general

error_log( json_encode( $group_settings) );

{
	"errors": {
		"rest_setting_setting_group_invalid": ["Invalid setting group."]
	},
	"error_data": {
		"rest_setting_setting_group_invalid": {
			"status": 404
		}
	}
}

To Reproduce

Refresh a page. Orders page is a sure one. Probably more.

Refresh the admin orders list page.

Expected behavior

Clean logs.

Environment:

WooCommerce 4.7.0
Siteground WordPress hosting.
PHP 7.3

@moon0326
Copy link
Contributor

@BrianHenryIE Thank you for submitting your bug report.

I was not able to reproduce the error with a fresh installation of WordPress + WooCommerce. However, I can see how this can happen since there is no error handling logic when an invalid group setting I.D is given. We will work on a fix.

@moon0326
Copy link
Contributor

@BrianHenryIE Hi :)

Could you do me a favor, please? I would like to find out what's causing this error before we push out a fix.

  1. Could you send me a list of activated plugins? You can get it by navigating to Tools -> Site Health -> Info and click [ Copy site info to clipboard ].
  2. It would be also very helpful if you can print out the contents of $preload_settings variable in Loader.php. You can use the following snippet.
$preload_settings = apply_filters( 'woocommerce_admin_preload_settings', array() );
error_log( json_encode( $preload_settings) );

Thank you,
Moon

@dougaitken
Copy link
Member

As a note, a customer came across this error and reached out in Live Chat - 25863716-hc - they let us know that deactivating and reactivating the core WooCommerce plugin removed the error

@moon0326
Copy link
Contributor

@dougaitken Thank you! I will read through the ticket and test it myself.

@BrianHenryIE
Copy link
Author

BrianHenryIE commented Dec 9, 2020

Hi again, sorry for the delay.

I disabled our 70 plugins and enabled them one by one, refreshing the admin orders list page each time and checking the log file!

The problem is with the WooCommerce Anti Fraud plugin version 3.3 (latest), WooCommerce 4.7.1 & 4.8.0, and WordPress 5.5.3 (when no other plugins are active). Also occurs with WooCommerce Admin 1.7.2 plugin active.

I'll file a bug report with them too with a link here.

deactivating and reactivating the core WooCommerce plugin removed the error

This did not work in my case.

@becdetat becdetat added the type: bug The issue is a confirmed bug. label Dec 18, 2020
@BrianHenryIE
Copy link
Author

An update has been released to WooCommerce Anti Fraud to address this problem. Their changelog says:

2020-12-17 version 3.4

  • PLUGINS-837 - Bug fixed: Filter on settings cause notice errors in Woocommerce Admin plugin

I haven't had time to make a diff to understand/explain it more (and probably won't unless someone is interested).

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the status: stale The issue/PR is stale label Feb 18, 2021
@github-actions
Copy link

This issue was automatically closed due to being stale. Please feel free to re-open it if you still experience this problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: stale The issue/PR is stale type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants