最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WooCommerce Webhooks not firing because of error in wp-includesmeta.php

programmeradmin5浏览0评论

I'm trying to implement a WooCommerce Webhook that fires when an order was updated to tell another system that it needs to generate a file based on the payload provided via the webhook. For getting to know what is actually sent and in which cases I've created a new WebHook that is sending to a RequestBin:

Webhook Configuration

Status: Active
Topic: Order updated
Delivery URL: a RequestBin URL
Secret: somesecret
API version: WP Rest API Integration v3

I've noticed that nothing was sent and WordPress was logging the error shown below:

error message in debug.log

PHP Notice:  Trying to access array offset on value of type bool in .../woocommerce/wp-includes/meta.php on line 582

wp-includes/meta.php

580 if ( ! $meta_cache ) {
581     $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
582     $meta_cache = $meta_cache[ $object_id ];
583 }

I've nailed down the issue further and it has shown that update_meta_cache() in line 581 is sometimes returning false and, as a result, $meta_cache is not an array but a boolean. This case can happen only if $object_ids or $meta_type is empty/null or _get_meta_table() inside update_meta_cache() returns null. Unfortunately, a webhooks-delivery log file is not created by WooCommerce.

Am I doing something wrong, is proper error handling missing in line 582 or is it just a configuration issue or bug?

Thanks in advance.

发布评论

评论列表(0)

  1. 暂无评论