[wp-trac] Re: [WordPress Trac] #8620: Fatal error with HTTP class
WordPress Trac
wp-trac at lists.automattic.com
Sun Apr 5 00:54:44 GMT 2009
#8620: Fatal error with HTTP class
---------------------------+------------------------------------------------
Reporter: momo360modena | Owner: westi
Type: defect (bug) | Status: assigned
Priority: high | Milestone: 2.7.2
Component: HTTP | Version: 2.7
Severity: major | Keywords: has-patch
---------------------------+------------------------------------------------
Comment(by hakre):
First off, naturally every public function should sanitize the input to
the function. because this is all php4, it might look like a little bit
overheaded, so w/o answering this question a fix like the suggested one to
"fix it in the phpdocs" sounds valuable anyway.
i checked the source in ''/wp-includes/http.php'' for php doc comments and
i saw those are _not_ in now. infact some comments look like just
duplicated from one function to the other rendering them useless.
* wp_remote_retrieve_response_code()
* wp_remote_retrieve_response_message()
additionally related to this report,
''wp_remote_retrieve_response_code()'', does not return WP_Error on
failure any longer. It returns an empty string on failure. it might throw
a warning, if there exists a response entry in the $response array but if
there is no code. this should be checked (compareable to
''wp_remote_retrieve_header''). a similar mistake is found in
''wp_remote_retrieve_response_message()''.
I created a patch that does make some minor changes to the code in the
hope it gets mature. This is against the current SVN and contains modifed
docblocks reflecting the correct return types. additionally further checks
have been provided sothat no warning will be thrown if array indexes do
not exist. those check were previously incomplete and could mostly be
reduced to one isset command.
patch will follow.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8620#comment:11>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list