Closed Bug 214921 Opened 21 years ago Closed 19 years ago

no output displayed from php script containing "session_start()" clause

Categories

(Core :: Networking: HTTP, defect)

x86
All
defect
Not set
major

Tracking

()

RESOLVED EXPIRED

People

(Reporter: mtv2002, Assigned: darin.moz)

References

()

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624

Mozilla won`t display page produced by PHP-script containing "session_start()"
clause. Look at "http://www.wml.h1.ru/test2.php".

Reproducible: Always

Steps to Reproduce:
1. Create PHP-file with code shown at "http://www.wml.h1.ru/test2.php".
2. Uploade the file to a server, on which PHP-parser installed.
3. Try to open the file in IE and then in Mozilla.
4. See the difference.
Actual Results:  
IE displays the page as it was intended to be displayed.
Mozilla displays nothing.

Expected Results:  
Display the page.

As far as I know, what "session_start()" does is generates session ID and sends
session cookie. These tasks are done OK, I checked that: session ID is available
on subsequent pages as $_COOKIE['session_name()'], but those pages are only
visible in Mozilla if "session_start()" was removed from them.
Though not displaing output, Mozilla nevertheless understands HTTP-headers sent
from the script. For example, I write: "session_start(); header('Location:
http://www.mysite.net/');" and Mozilla goes to that address. So I tried to solve
the problem by sending HTTP-header "HTTP/1.1 200 OK" after "session_start()".
But nothing changed.
It looks like that page just has weird stuff on it.

<script language=JavaScript src=http://ad.agava.tbn.ru/bb.cgi?cmd=ad&pubid=28388
77&pg=1&r=js&ssi=nofillers&vbn=161&num=1&w=0&h=0&p=<center><FONT SIZE=1><A HREF=
"http://www.agava.ru" target = "_top" > AGAVA Software Projects</A></FONT></cent
er>></script>

That doesn't look like valid html to me.
No, the problem has absolutely nothing to do with the "wierd stuff"
mentioned above. I tested it on another server without any compulsory
advertisements, no difference.
If I go to about:config and modify "network.http.accept-encoding" so it is
blank, then the page works fine.  Maybe it's a server error (sending bad data)
when the UA sends the "Accept-Encoding: gzip,deflate" header.

-> Networking:HTTP for further triage
Assignee: general → darin
Component: Browser-General → Networking: HTTP
OS: Windows 98 → All
QA Contact: general → httpqa
Running with Mats idea.  When mozilla sends Accept-Encoding: gzip,deflate.
(default) the server sends Content-Encoding: gzip. but the content is not gziped.
I found bug 129021 which has the same encoding problem.
To re reproduce the bug just test this file on your server.
The initial URL (www.wml.h1.ru/test2.php) is not valid any more. Try
"http://wml.h1.ru/session_test.php" or better test the sourse code attached.
I've just found that Mozilla DOES DISPLAY the the page at
"http://wml.h1.ru/session_test.php". Then the problem is in something else, not
in  "session_start()".
Attachment #129206 - Attachment mime type: text/html → text/plain
Comment on attachment 129206 [details]
sourse code that DOES NOT cause the problem

><?php 
>session_start();
>$_SESSION["TEXT"]='Some text.';
>?>
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
><html xmlns="http://www.w3.org/1999/xhtml">
><head>
><meta http-equiv="Content-Type" content="text/html; Charset=Windows-1251" />
><meta http-equiv="Content-Script-Type" content="text/javascript" />
><title>TEST</title>
></head>
><body>
>	<p><?php echo $_SESSION["TEXT"]; ?></p>
></body>
></html>
Attachment #129206 - Attachment description: the sourse code that causes the problem → sourse code that DOES NOT cause the problem
Comment on attachment 129206 [details]
sourse code that DOES NOT cause the problem

><?php 
>session_start();
>$_SESSION["TEXT"]='Some text.';
>?>
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
><html xmlns="http://www.w3.org/1999/xhtml">
><head>
><meta http-equiv="Content-Type" content="text/html; Charset=Windows-1251" />
><meta http-equiv="Content-Script-Type" content="text/javascript" />
><title>TEST</title>
></head>
><body>
>	<p><?php echo $_SESSION["TEXT"]; ?></p>
></body>
></html>
Probably, it is not Mozilla's bug. The same code (see the attachment) works fine
on one server (h1.ru) and doesn't work on another (goldhost.ru). Apparently, the
problem is in server configuration (see "http://www.goldhost.ru/phpinfo.php" and
"http://wml.h1.ru/phpinfo.php").
I'm also seeing this behaviour, on a server I run and two others.  Interestingly
when I checked before it only had this problem with mozilla on windows, not on
Linux.

Anyone want to hazard a guess as to what PHP config option is the problem if it
is such?  I'm fully able and willing to try out changes on my server.
Confirmed with 2003082704 mozilla-win32-installer-sea.exe (pages don't work),
and 2003082722 mozilla-i686-pc-linux-gnu.tar.gz (pages DO work).

http://www.eve-i.com/
http://www.xanaducorp.net/index2.html
http://fa.miggy.org/pp/  (this is the one on my server that I can test changes on)

For the latter removing the session_start() call in the php allows the page to
load, with the call there the page refuses to load.  The symptom is that you're
still looking at the previously browsed page and a reload will reload THAT. 
Absolutely no output is shown for the 'broken' page.

So, what is Linux mozilla doing/not doing that win32 mozilla isn't/is ?
I've now taken the php code from mtv2002@pisem.net and placed it at:

http://www.miggy.org/test/session.php

This DOES load fine on 2003082722 Linux mozilla, but does NOT on 2003082704
Win32 mozilla.  In the latter case it *does* set the cookie, so at least the
headers are being received to some degree, but then fails to display the page as
previously described.
Yup, me again.

I've tcpdumped both clients now, the result is:

Win32 2003082704
Request:
-------------------------------- cut here ------------------------------
GET /test/session.php HTTP/1.1
Host: www.miggy.org
User-Agent: Mozilla /5.0 (Windows; U; Win98; en-US; rv:1.5b) Gecko/20030827
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en,en-us;q=0.5
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Cookie: PHPSESSID=16fc51332fa2265d8bb0eb0f611388e2
-------------------------------- cut here ------------------------------

Linux 2003082722
Request:
-------------------------------- cut here ------------------------------
GET /test/session.php HTTP/1.1
Host: www.miggy.org
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: 1.5b) Gecko/20030827
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
-------------------------------- cut here ------------------------------

A small discrepancy here.  The lack of 'Accept-Encoding' on the win32 one is
because I did blank that config option to see if it would help, it doesn't,
neither does resetting it make things work.  Because on Linux this previously
worked I already have the cookie set and being sent back.

Now the output:

win32:
-------------------------------- cut here ------------------------------
HTTP/1.1 200 OK
Date: Thu, 28 Aug 2003 12:39:24 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26 PHP/4.1.2
X-Powered-By: PHP/4.1.2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

234
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; Charset=Windows-1251" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>TEST</title>
</head>
<body>
        <p>Some text.</p>
        <p>This page opens ok in IE, but Mozilla does not display it at all.</p>
        <p>When PHP-script contains <b>session_start()</b> clause, Mozilla won`
t produce any output.</p>
</body>
</html>
-------------------------------- cut here ------------------------------

linux:
-------------------------------- cut here ------------------------------
HTTP/1.1 200 OK
Date: Thu, 28 Aug 2003 12:32:25 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux mod_perl/1.26 PHP/4.1.2
X-Powered-By: PHP/4.1.2
Set-Cookie: PHPSESSID=db07e63b34ca345f6c31027a59699ceb ; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

234
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; Charset=Windows-1251" />
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<title>TEST</title>
</head>
<body>
        <p>Sometext.</p>
        <p>This page opens ok in IE, but Mozilla does not display it at all.</p>
        <p>When PHP-script contains <b>session_start()</b> clause, Mozilla won`t
produce any output.</p>
</body>
</html>

-------------------------------- cut here ------------------------------

Again the small discrepancy due to the cookie already being set with linux
mozilla.  Other than that the output is identical, which seems to decry the
notion that this problem is anything to do with the server the page is on.

Although, what's that "234" ?  Length of the following output ?  If so, that
cuts off at around the "Char" in "Charset=Windows-1251" />".  Maybe something
wrong with the Transfer-Encoding: chunked code in PHP that the linux mozilla is
ignoring ?
Ok, actually read a spec. on Chunked encoding, the size is in hex, and does seem
to match.  I've been playing with using netcat as a very simple server and still
seeing the problem, yet can't seem to exactly track down what triggers it as yet.
  The last mozilla I tried was a nightly from 25th October, on win32 only, and
it had the bug.  These versions definitely have it too: 2003080704, 2003081304,
2003082704, 2003100804.  The Firebird I don't see the bug in is the 0.7
'release' version, I've also not seen it in a nightly datestamped 2003-10-27 14:42.
  If I get chance I'll check latest nightlies of both.
This is unchancged, other than deleting editor.history_title_X and
editor.history_url_X lines, for privacy reasons, from the prefs.js that
exhibits the problem.
Using the test URL: http://www.miggy.org/test/session.php which is:

------------- cut here ---------------
<?php
session_start();
$_SESSION["TEXT"]='Some text.';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; Charset=Windows-1251" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>TEST</title>
</head>
<body>
        <p><?php echo $_SESSION["TEXT"]; ?></p>
        <p>This page opens ok in IE, but Mozilla does not display it at all.</p>
        <p>When PHP-script contains <b>session_start()</b> clause, Mozilla won`t
produce any output.</p>
</body>
</html>

------------- cut here ---------------

Mozilla nightly 2003102804 - Exhibits the problem, 'View Source' on the 'Loaded'
page showing only "<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"><html><head><title></title></head><body></body></html>".  This
is opening the
 page in a fresh tab.  Doing so in an old tab 'view source' shows that for the p
reviously loaded page.
Mozilla "1.5" release (2003100716) - Exhibits the problem, identically.
Mozilla "1.6a" (2003103019) - Exhibits the problem, identically.
Mozilla Firebird "0.7" (20031007) - Does NOT exhibit the problem.
Mozilla Firebors nightly 20031030 - Does NOT exhibit the problem.              
                                                                                
  I also re-ran 'Mozilla "1.6a" (2003103019)' after renaming
C:\Win98\Profiles\athan\Application Data\Mozilla\  to C:\....\was-Mozilla\ to
nuke all my preferences.  This did NOT then exhibit the problem.  So, any
suggestions as to what pref
erence my end could be causing the problem ?  I *DID* accept the cookie when pro
mpted about it, the same as when it worked in Firebird.

  I'm attaching my prefs.js, I have only deleted the editor.history_title_X and
editor.history_url_X lines, as some contained user:passwords for private URLs.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: