Make WordPress Core

Opened 11 years ago

Last modified 5 years ago

#23915 assigned defect (bug)

discover_pingback_server_uri cases an error when discovery URI sets multiple Content-type headers — at Initial Version

Reported by: tomdxw's profile tomdxw Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Pings/Trackbacks Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

Line 1673 in wp-includes/comment.php uses preg_match() on the output of wp_remote_retrieve_header(). When multiple headers are set of the same name, wp_remote_retrieve_header() returns an array.

Thus occasionally the following error occurs:

PHP Warning: preg_match() expects parameter 2 to be string, array given in xxxxxxx/wp-includes/comment.php on line 1673

I have no idea how to make pingbacks happen so to reproduce, add this line to functions.php: discover_pingback_server_uri('http://localhost:8080/');

And in a terminal window run this (you may need to install the netcat-openbsd package in Debuntu): while true; do echo -en 'HTTP/1.1 200 OK\r\nContent-type: text/html\r\nContent-type: text/plain\r\n\r\n' | nc -lp 8080; done

Then visit your WP installation and you shall get the aforementioned error message.

Change History (0)

Note: See TracTickets for help on using tickets.