From ab1ba581280961ed9a2b31a630b3fc45d62c64a3 Mon Sep 17 00:00:00 2001 From: Fulvio Notarstefano Date: Wed, 29 May 2019 12:47:26 +0800 Subject: [PATCH 1/2] [#23839] Do not throw an autoloader notice if following the notice recommendation --- includes/class-wc-autoloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-autoloader.php b/includes/class-wc-autoloader.php index 2452172faf7..d86ef67022b 100644 --- a/includes/class-wc-autoloader.php +++ b/includes/class-wc-autoloader.php @@ -91,7 +91,7 @@ class WC_Autoloader { } // Prevent plugins from breaking if they extend the rest API early. - if ( 0 === strpos( $class, 'wc_rest_' ) && ! did_action( 'rest_api_init' ) ) { + if ( 0 === strpos( $class, 'wc_rest_' ) && ! class_exists( $class ) && ! did_action( 'rest_api_init' ) ) { wc_doing_it_wrong( $class, __( 'Classes that extend the WooCommerce/WordPress REST API should only be loaded during the rest_api_init action, or should call WC()->api->rest_api_includes() manually.', 'woocommerce' ), '3.6' ); WC()->api->rest_api_includes(); } From aba51d4c769443e43ec2127ae42b14b962d51336 Mon Sep 17 00:00:00 2001 From: Fulvio Notarstefano Date: Thu, 6 Jun 2019 09:56:30 +0800 Subject: [PATCH 2/2] [#23839] Use false arg in class_exists() --- includes/class-wc-autoloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-autoloader.php b/includes/class-wc-autoloader.php index d86ef67022b..f1d66e8dbdd 100644 --- a/includes/class-wc-autoloader.php +++ b/includes/class-wc-autoloader.php @@ -91,7 +91,7 @@ class WC_Autoloader { } // Prevent plugins from breaking if they extend the rest API early. - if ( 0 === strpos( $class, 'wc_rest_' ) && ! class_exists( $class ) && ! did_action( 'rest_api_init' ) ) { + if ( 0 === strpos( $class, 'wc_rest_' ) && ! class_exists( $class, false ) && ! did_action( 'rest_api_init' ) ) { wc_doing_it_wrong( $class, __( 'Classes that extend the WooCommerce/WordPress REST API should only be loaded during the rest_api_init action, or should call WC()->api->rest_api_includes() manually.', 'woocommerce' ), '3.6' ); WC()->api->rest_api_includes(); }