php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39284 sessions start with javascript in header causes refresh to not work in IE 7
Submitted: 2006-10-27 18:39 UTC Modified: 2006-10-27 22:37 UTC
From: paul dot visco at roswellpark dot org Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.1.6 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2006-10-27 18:39 UTC] paul dot visco at roswellpark dot org
Description:
------------
Pages using PHP sessions and external javascript in the head portion of the html document and which served from IIS 6 to IE 7 are not refreshing properly (displays blank on refresh). I have a full description of it here including the minimal source to create the error.

Description, source and work arounds that may shed light on the problem: http://durge.roswellpark.org/ie7Bugs/

I think it has to do with IIS not reporting Content-Length because if I buffer all output till the end, set Content-Length header and then echo buffer to client it works.

e.g. work around http://durge.roswellpark.org/ie7Bugs/sourceWithOutputBuffering.php


Reproduce code:
---------------
Source with description: http://durge.roswellpark.org/ie7Bugs/

<?php
session_start();
?><html>
<head>

<script type="text/javascript" src="javascript.js"></script>
<title>IE 7 false content-length - refresh bug demo</title>

</head>
<body>
<h1>IE 7 Content-Length Bugs</h1>
<p>This will not show up on refrrsh when served from IIS 6 with PHP 5.1.6 to IE 7.</p>

</body>
</html>

Expected result:
----------------
The page should display the text on load and on refresh.

Actual result:
--------------
The page does not refresh properly when served from IIS 6 to IE 7.  Look fine on first load, but appears intermittently blank on refresh.  Works fine in firefox and IE 6.  it only happens when there 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-27 21:47 UTC] tony2001@php.net
Please explain why do you think it's a problem of PHP, not IE7.
 [2006-10-27 22:30 UTC] paul dot visco at roswellpark dot org
I don't think that the problem is PHP's fault. In fact I am sure it is an IE 7 problem.  I just think perhaps there can be a PHP solution as turning zlib_compression on or using output buffering to buffer the whole page works.

  Considering so many people are going to be using IE 7 to view PHP pages served from IIS , I imagine it might be something you would want to look into.

I re-wrote the problem description page to break down the problem more.

here is the source required
<?php
session_start();
?><html>
<head>
<script type="text/javascript" src="javascript.js"></script>
</head>
<body>
<h1>This data will not show up properly on refresh</h1>
</body>
</html>


FACT: Page will not refresh properly (shows up blank on refresh) in IE 7 when the following conditions are met:

   1. PHP page uses session_start();
   2. AND There is external link to javascripts in the HEAD of the document.
   3. AND The page is not completely output buffered until the end of the doc OR zlib.output_compression is not enabled in the php.ini ( it is not enabled by default)
   4. AND The page is being served on IIS 6

Work Arounds

   1. Do not put your external javascript in the head of the document. E.g. move it somewhere else. Not acceptable as it does not cache and essage with page organization. (View Page Source)
   2. Edit php.ini to set zlib.output_compression to On. This seesm to fix the problem but is not enabled by default in php.ini
   3. If you cannot change your php.ini settings use inline PHP output buffering with ob_start and ob_get_clean();

   4. View the page with firefox or IE 6.

Hope this makes it more clear.  I also reported the bug to microsoft.

Thanks,
Paul
 [2006-10-27 22:37 UTC] tony2001@php.net
>I also reported the bug to microsoft.
Great, thanks.

Not PHP problem -> bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 01 21:00:01 2025 UTC