• We’re getting this error on POST requests to /wp-admin/admin-ajax.php?_fs_blog_admin=true:

    
    PHP Fatal error: Uncaught Error: Non-static method Routeapp_Public::fillMetaData() cannot be called statically in /var/www/html/wp-content/plugins/routeapp/public/class-routeapp-public.php:249
    Stack trace:
    #0 /var/www/html/wp-includes/class-wp-hook.php(309): Routeapp_Public::routeapp_ajax_add_order_item_meta(389708, Object(WC_Order_Item_Product))
    #1 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
    #2 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #3 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(961): do_action('woocommerce_aja...', 389708, Object(WC_Order_Item_Product), Object(Automattic\\WooCommerce\\Admin\\Overrides\\Order))
    #4 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(897): WC_AJAX::maybe_add_order_item(552382, '', Array)
    #5 /var/www/html/wp-includes/class-wp-hook.php(307): WC_AJAX::add_order_item('')
    #6 /var/www/html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
    #7 /var/www/html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
    #8 /var/www/html/wp-admin/admin-ajax.php(187): do_action('wp_ajax_woocomm...')
    #9 {main}
     thrown in /var/www/html/wp-content/plugins/routeapp/public/class-routeapp-public.php on line 249
    

    WordPress 6.0
    Server architecture Linux 5.13.0-1022-aws x86_64
    Web server Apache/2.4.53 (Debian)
    PHP version 8.0.19 (Supports 64bit values)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter synapdylan

    (@synapdylan)

    I’ve tried hacking in a fix by adding the static keyword to the fillMetaData() and addItemMeta() methods in wp-content/plugins/routeapp/public/class-routeapp-public.php. There may be more of these bugs, I’ve only addressed the ones throwing errors on my client’s site.

    Thread Starter synapdylan

    (@synapdylan)

    At least one more method needs to be static, addOrderItemMeta(). That fixes the trigger we identified, adding products to an order on the back end.

    Thread Starter synapdylan

    (@synapdylan)

    Forgot to mention we are running version 2.1.8 of the Route App plugin.

    Thread Starter synapdylan

    (@synapdylan)

    This bug affects version 2.1.9 as well. Here is a diff of my local fix:

    --- class-routeapp-public.php
    +++ class-routeapp-public-fix.php
    @@ -174,7 +174,7 @@
          * @param $entity_type enum('order_item','item')
          * @return void
          */
    -    public function fillMetaData($item, $product, $entity_type='order_item') {
    +    public static function fillMetaData($item, $product, $entity_type='order_item') {
    
             $sourceProductId = $product->get_id();
             $productImageUrl = (wp_get_attachment_url($product->get_image_id())) ? wp_get_attachment_url($product->get_image_id()) : null;
    @@ -259,7 +259,7 @@
          * @param $value String
          * @return bool
          */
    -    private function addOrderItemMeta($itemId, $key, $value) {
    +    private static function addOrderItemMeta($itemId, $key, $value) {
             try {
                 $fieldExists = wc_get_order_item_meta( $itemId, $key, true);
                 if (!$fieldExists) {
    @@ -277,7 +277,7 @@
          * @param $value String
          * @return bool
          */
    -    private function addItemMeta($item, $key, $value) {
    +    private static function addItemMeta($item, $key, $value) {
             try {
                 $fieldExists =  $item->get_meta($key, true);
                 if (!$fieldExists) {
    Thread Starter synapdylan

    (@synapdylan)

    This bug affects version 2.2.0.

    Thread Starter synapdylan

    (@synapdylan)

    This bug affects version 2.2.1 also.

    Thread Starter synapdylan

    (@synapdylan)

    This bug affects version 2.2.2 also.

    Thread Starter synapdylan

    (@synapdylan)

    This bug affects version 2.2.3 also.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Non-static method Routeapp_Public::fillMetaData() cannot be called statically’ is closed to new replies.