4

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();
iftheshoefritz
  • 5,829
  • 2
  • 34
  • 41
  • I used to work for a web portal running Drupal that, IIRC, had exactly the same problem... They never managed to find out what it was. Interested to see whether solutions come up. – Pekka Nov 12 '10 at 09:05
  • Are you using a reverse proxy in your setup somewhere? (See my edited answer below for why I ask this.) – Henrik Opel Nov 12 '10 at 10:05
  • We are using Squid, which (apparently) is a reverse proxy... I've never heard the term before so it's going to take me a while to investigate – iftheshoefritz Nov 12 '10 at 10:25

4 Answers4

5

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.)

Henrik Opel
  • 19,341
  • 1
  • 48
  • 64
3

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.

googletorp
  • 33,075
  • 15
  • 67
  • 82
0

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

danorton
  • 11,804
  • 7
  • 44
  • 52
  • I saw this somewhere while investigating Henrik Opel's advice. Unfortunately there were other sites running on the same Apache server that I wasn't prepared to disturb – iftheshoefritz Feb 13 '11 at 22:33
0

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!

alecs
  • 1