Mysterious number appears above Drupal-generated H

2019-05-07 05:55发布

问题:

On a number of pages on my Drupal site a mysterious number appears above (EDIT: and below) the HTML the first time the page is visited in (EDIT) any browser. In IE7 and IE8 the problem pages are rendering incorrectly, but in the other browsers the rest of the page renders without problems. After a refresh the number usually disappears. My users tell me that the error occurs again each morning, although I've seen one case where a user refreshes and the strange number does NOT go away. I've had no problems with other browsers.

Here are the first few lines of HTML:

3535 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"   http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

.. the rest of the page generates normally, and then I see the following at the bottom:

</html> 

0 

I'm baffled - nothing related appears on either apache logs or my vhost error.log. I've done a diff of the html on pages with the number versus pages without and apart from the numbers at top and bottom the only difference is whitespace.

I'm running Drupal 6.19 in Apache 2.2 on Ubuntu 7.04. PHP version is 5.2.

For reference here's my index.php - I don't think there's anything that we've changed from the standard.

<?php
// $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $

/**
 * (Drupal copyright ommitted for brevity)
 */

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$return = menu_execute_active_handler();

// Menu status constants are integers; page content is a string.
if (is_int($return)) {
  switch ($return) {
    case MENU_NOT_FOUND:
      drupal_not_found();
      break;
    case MENU_ACCESS_DENIED:
      drupal_access_denied();
      break;
    case MENU_SITE_OFFLINE:
      drupal_site_offline();
      break;
  }
}
elseif (isset($return)) {
  // Print any value (including an empty string) except NULL or undefined:
  print theme('page', $return);
}

drupal_page_footer();

回答1:

Before spending much time checking your own code, analyze the involved network setup.

We had a similar phenomenon about a year ago where a proxy server inserted numbers like that into the pages he relayed.

I do not remember the details about what proxy server it was, and why he did it, but it was pretty obvious, as only people accessing the site from certain networks would get these numbers.

EDIT: I'm not 100% sure, but I think it was this nginx reverse proxy issue (This post might be related as well.)



回答2:

Most likely the markup is the same for all browsers but only IE renders it.

My best guess is that somewhere there is a snip of debugging code that is printing out some id. If you have any modules/theme you have developed yourself that would be the best place to start.

If you can't find the source, you can try to switch theme and turn off modules, you should be able to pinpoint it eventually. At first try searching your code for a print_r statement.



回答3:

Presuming that you're using the reverse proxy for all access to Apache, add the following lines to the global configuration (e.g. apache2.conf):

SetEnv force-response-1.0 1
SetEnv downgrade-1.0 1

For my Ubuntu/Debian installation (with nginx as the reverse proxy), I put these lines into /etc/apache2/conf.d/force-http-1.0.conf



回答4:

i don´t know if is the same problem, but one morning on all may drupal pages was a strange code showin at the very buttom, i wasn´t understanding, any way it was a page that i created a night before destinated to a feedbackform, i deleted that and all back to normal, any way some times this things happends because of a overloading of the catche, just ho do phpmyadmin and clear the catche, i hpe this helps, se ya!