Skip to content
Snippets Groups Projects
Commit 5918e55b authored by Alexander Hass's avatar Alexander Hass
Browse files

Issue #2303177: "Back to Top" Page anchor being reported as a 404 error

parent 652e1b6c
No related branches found
No related tags found
No related merge requests found
...@@ -563,10 +563,14 @@ function _linkchecker_status_handling(&$response, $link) { ...@@ -563,10 +563,14 @@ function _linkchecker_status_handling(&$response, $link) {
// element (naming it with the name attribute), or by any other element // element (naming it with the name attribute), or by any other element
// (naming with the id attribute). // (naming with the id attribute).
// See http://www.w3.org/TR/html401/struct/links.html // See http://www.w3.org/TR/html401/struct/links.html
//
// Notes:
// - '#top' is a reserved fragment that must not exist in a page.
if ($response->code == 200 if ($response->code == 200
&& !empty($response->data) && !empty($response->data)
&& !empty($response->headers['content-type']) && !empty($response->headers['content-type'])
&& !empty($response->uri['fragment']) && !empty($response->uri['fragment'])
&& !in_array($response->uri['fragment'], array('#top'))
&& in_array($response->headers['content-type'], array('text/html', 'application/xhtml+xml', 'application/xml')) && in_array($response->headers['content-type'], array('text/html', 'application/xhtml+xml', 'application/xml'))
&& !preg_match('/(\s[^>]*(name|id)(\s+)?=(\s+)?["\'])(' . preg_quote($response->uri['fragment'], '/') . ')(["\'][^>]*>)/i', $response->data) && !preg_match('/(\s[^>]*(name|id)(\s+)?=(\s+)?["\'])(' . preg_quote($response->uri['fragment'], '/') . ')(["\'][^>]*>)/i', $response->data)
) { ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment