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

PhP Notice/Warning messages

$
0
0

Replies: 0

Howdy!

This is an easy one to brighten your day.
[11-Nov-2021 21:43:54 UTC] PHP Notice: Undefined variable: gateways in /home/…/wp-content/plugins/woo-stripe-payment/includes/admin/meta-boxes/class-wc-stripe-admin-meta-box-product-data.php on line 64
[11-Nov-2021 21:43:54 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/…/wp-content/plugins/woo-stripe-payment/includes/admin/meta-boxes/views/html-product-data.php on line 18

Both are from the same cause:

private static function get_payment_gateways() {
		foreach ( self::$_gateways as $gateway ) {
			$gateways[ $gateway->id ] = $gateway;
		}
		return $gateways;
	}

As you can see, $gateways is not initialized. SHould be able to add:
$gateways = [];
before the foreach, and all should be fixed.

Thanks!


Viewing all articles
Browse latest Browse all 59525

Trending Articles