Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

PHP Warning: Attempt to read property “ID” on null

$
0
0

Replies: 0

Hi,

I’m seeing the following warnings repeated at least once every day in our log:

PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 89
PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 89
PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 89
PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 89
PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 249
PHP Warning:  Attempt to read property "ID" on null in /srv/wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php on line 22

It’s always these five warnings emitted together in this order, belonging to the following functions:

89: woocommerce_wp_hidden_input
249: woocommerce_wp_radio
22: woocommerce_wp_text_input

The three lines are identical:

$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;

Since the warnings are emitted from lines within the WooCommerce plugin, ofc I don’t immediately see the caller causing this, but within our entire WordPress install, only your plugin contains any calls of woocommerce_wp_hidden_input (4 calls + 1 commented out) & woocommerce_wp_radio (1 call – so those counts fit too).

The warnings are so far apparently harmless, at least nobody has ever complained. Unfortunately, that has also prevented me from figuring out how to reproduce it.

DHLfW 2.8.12 (last occurrences yesterday; now .14 is installed; I’m seeing the warnings as early as log start @ 18-Feb-22)
WC 6.4.1
WP 5.9.3
Divi 4.17.3
PHP 8.0.17


Viewing all articles
Browse latest Browse all 59525

Trending Articles