From 38bf57ccb0af1ce7a1329b05461c1b75bedcead4 Mon Sep 17 00:00:00 2001
From: Mohammad Jangda <batmoo@gmail.com>
Date: Wed, 24 Jul 2013 16:43:07 -0400
Subject: [PATCH] Fix fatal in get_site_info method.

Need to check that site state is an array.

Fatal error for /wp-cron.php?doing_wp_cron=123 includes/class-wp-push-syndication-server.php:999 - Cannot use object of type WP_Error as array
---
 includes/class-wp-push-syndication-server.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/includes/class-wp-push-syndication-server.php b/includes/class-wp-push-syndication-server.php
index 46dd4f2..209c71d 100644
--- a/includes/class-wp-push-syndication-server.php
+++ b/includes/class-wp-push-syndication-server.php
@@ -996,7 +996,7 @@ class WP_Push_Syndication_Server {
 			return array( 'state' => 'new' );
 
 		foreach( $slave_post_states as $state => $sites  ) {
-			if(   array_key_exists( $site_ID, $sites )   &&   !empty( $sites[ $site_ID ]['ext_ID'] )   ) {
+			if( isset( $sites[ $site_ID ] ) && is_array( $sites[ $site_ID ] ) && empty( $sites[ $site_ID ]['ext_ID'] )   ) {
 				if( $client->is_post_exists( $sites[ $site_ID ]['ext_ID'] ) ) {
 					$info = array(
 						'state'     => $state,
-- 
GitLab