@@ -178,10 +178,7 @@ public function handle_remote_post_responses($response, $url, $scope, $expecting
178178 return $ this ->handle_empty_response_body ($ response , $ url , $ scope );
179179 }
180180
181- $ decoded_body = false ;
182- if (is_serialized ($ response ['body ' ])) {
183- $ decoded_body = Util::unserialize ($ response ['body ' ]);
184- } elseif (Util::is_json ($ response ['body ' ])) {
181+ if (Util::is_json ($ response ['body ' ])) {
185182 $ decoded_body = json_decode ($ response ['body ' ], true );
186183 } else {
187184 $ decoded_body =
@@ -227,31 +224,6 @@ public function handle_remote_post_responses($response, $url, $scope, $expecting
227224 }
228225 }
229226
230- // if ($expecting_serial && false === is_serialized($response['body'])) {
231- // if (0 === strpos($url, 'https://') && 'ajax_verify_connection_to_remote_site' == $scope) {
232- // return true;
233- // }
234- // $this->error_log->setError(__('There was a problem with the AJAX request, we were expecting a serialized response, instead we received:<br />', 'wp-migrate-db') . esc_html($response['body']));
235- // $this->error_log->log_error($this->error_log->getError(), $response);
236- //
237- // return false;
238- //
239- // } elseif ($expecting_serial && ('ajax_verify_connection_to_remote_site' == $scope || 'ajax_copy_licence_to_remote_site' == $scope)) {
240- //
241- // $unserialized_response = Util::unserialize($response['body'], __METHOD__);
242- //
243- // if (false !== $unserialized_response && isset($unserialized_response['error']) && '1' == $unserialized_response['error'] && 0 === strpos($url, 'https://')) {
244- //
245- // if (stristr($unserialized_response['message'], 'Invalid content verification signature')) {
246- //
247- // //Check if remote address returned is the same as what was requested. Apache sometimes returns a random HTTPS site.
248- // if (false === strpos($unserialized_response['message'], sprintf('Remote URL: %s', $state_data['url']))) {
249- // return true;
250- // }
251- // }
252- // }
253- // }
254-
255227 return true ;
256228 }
257229
@@ -452,15 +424,11 @@ public function verify_remote_post_response($response)
452424 return $ result ;
453425 }
454426
455- if (Util::is_json ($ response )) {
456- return json_decode ($ response , true );
457- }
458-
459427 if (is_wp_error ($ response )) {
460428 return $ this ->end_ajax ($ response );
461429 }
462430
463- if (! is_serialized ( trim ( $ response) )) {
431+ if ( ! Util:: is_json ( $ response )) {
464432 $ return = array ('wpmdb_error ' => 1 , 'body ' => $ response );
465433 $ error_msg = 'Failed as the response is not serialized string (#115mf) ' ;
466434 $ this ->error_log ->log_error ($ error_msg , $ response );
@@ -469,7 +437,7 @@ public function verify_remote_post_response($response)
469437 return $ result ;
470438 }
471439
472- $ response = unserialize ( trim ( $ response) );
440+ $ response = json_decode ( $ response, true );
473441
474442 if (isset ($ response ['wpmdb_error ' ])) {
475443 $ this ->error_log ->log_error ($ response ['wpmdb_error ' ], $ response );
0 commit comments