Opened 4 years ago

Closed 4 years ago

#8591 closed defect (bug) (invalid)

PHP Error with WP_Error

Reported by: mattyrob Owned by:
Priority: normal Milestone:
Component: HTTP Version: 2.7
Severity: normal Keywords: has-patch developer-feedback
Cc:

Description

I'm getting a white screen on my main WordPress site when I Publish a post since starting to use 2.7.

My server error logs contain the following that matches time wise for every white screen I've seen:

PHP Catchable fatal error: Object of class WP_Error could not be converted to string in /home/prescrib/public_html/wp-includes/comment.php on line 1264

I have disabled all plugins and still get this error. (Strangely, this is not reproducible on my localhost dev WordPress so there may be some server settings involved too.

Attachments (2)

8591.diff (519 bytes) - added by vladimir_kolesnikov 4 years ago.
8591a.diff (2.7 KB) - added by vladimir_kolesnikov 4 years ago.

Download all attachments as: .zip

Change History (13)

  • Severity changed from critical to normal

And stranger still, if I amend the function that appear to be generating this error by adding a:

return false;

immediately the function is called I don't get the error in the logs but I still get a white screen!?!

This might happen when WP_Http_Fsockopen::chunkTransferDecode() fails to decode the response. In this case, $responsebody? becomes WP_Error, not a string:

$process['body'] = WP_Http::chunkTransferDecode($process['body']);

Need to add one extra check to discover_pingback_server_uri().

  • Keywords has-patch added
  • Keywords developer-feedback added

Attached a better patch that takes care of other places from which wp_remote_get()/wp_remote_post() are called.

  • Priority changed from highest omg bbq to normal
  • Summary changed from White Screen on Publish to PHP Error with WP_Error

I went back to basic and wiped my WordPress install and re-uploaded the core files fresh. This has resolved the white screen issue. Maybe the patch will fix the Error Log entry

comment:6   ryan4 years ago

  • Component changed from General to HTTP
  • Owner anonymous deleted

comment:7   ryan4 years ago

Addressed by [10282]?

comment:8 follow-up: ↓ 9   ryan4 years ago

And [10281].

comment:9 in reply to: ↑ 8   vladimir_kolesnikov4 years ago

Replying to ryan:

And [10281].

Need to update PhpDoc for chunkTransferDecode(), say:

- * @return bool|string|WP_Error False if not chunked encoded. WP_Error on failure. Chunked decoded body on success.
+ * @return bool|string False if not chunked encoded. Chunked decoded body on success.

Yes, from what I can tell that seems to have fixed the problem.

  • Milestone 2.7.1 deleted
  • Resolution set to invalid
  • Status changed from new to closed

Addressed upstream in #8618. PHPdoc is also fixed in that ticket for both 2.7 and trunk.

Note: See TracTickets for help on using tickets.