@j0aoj0aquim @rsouzaam The line of code is easy enough to solve, just check the return of the function for type before using it as an object.
Changing the line I mentioned earlier in something like this will solve it.
? ? ? ?$response_headers ?= wp_remote_retrieve_headers( $request );
? ? ? ? if ( ! is_object( $response_headers )
? ? ? ? || ! method_exists( $response_headers, 'getAll' ) ) {
? ? ? ? ? ? return [];
? ? ? ? }
? ? ? ? $response_headers ?= $response_headers->getAll();
or
? ? ? ?$response_headers ?= wp_remote_retrieve_headers( $request );
? ? ? ? if ( ! is_a( $response_headers,"WpOrgRequestsUtilityCaseInsensitiveDictionary" ) ) {
? ? ? ? ? ? return [];
? ? ? ? }
? ? ? ? $response_headers ?= $response_headers->getAll();
or something like:
? ? ? ?$response_headers ?= wp_remote_retrieve_headers( $request );
? ? ? ? if ( is_array ($response_headers ) ) {
? ? ? ? ? ? return [];
? ? ? ? }
? ? ? ? $response_headers ?= $response_headers->getAll();
Any of those should prevent the crash.
Looking more closely ate the code before the crashing statement, I’m guessing this function will crash when a pro version doesn’t have a license code. So that might have been the underlying problem. I don’t know what version you’re talking about, but it might explain why it hasn’t been reported here earlier.
Since the wp_remote_retrieve_headers() function may still return an empty array (instead of an WpOrgRequestsUtilityCaseInsensitiveDictionary object) when is_wp_error( $request ) returns false, it may be right to just check for the type of the header before using any methods on it anyway. Not crashing seems the more elegant way of resolving such issues.