Undefined array key “rest_route”
-
Hello,
I’m seeing a PHP warning to the PHP log when browsing the admin of a site.
PHP message: PHP Warning: Undefined array key "rest_route" in .../public/wp-content/plugins/stellarpay/src/Integrations/WooCommerce/FeatureSupport/ReactBasedPaymentSettings.php on line 114Checking the source within the
isWoocommerceAdminPaymentsProviderRestApiRequest()function on line 110, there’s an assumption that$GLOBALS['wp']->query_vars['rest_route']exists on line 114.Above this line, there is a check of:
if (!WC()->is_rest_api_request()) {
return false;
}Can this be expanded to also check the variable exists? e.g.
if (!WC()->is_rest_api_request() || empty( $GLOBALS['wp']->query_vars['rest_route'] )) {
return false;
}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Undefined array key “rest_route”’ is closed to new replies.