php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24788 CGI Application crashes obviously when redirecting webpage
Submitted: 2003-07-24 03:20 UTC Modified: 2003-07-29 07:26 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: christoph at chcnet dot net Assigned:
Status: No Feedback Package: CGI/CLI related
PHP Version: 4.3.2 OS: win2k advanced server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: christoph at chcnet dot net
New email:
PHP Version: OS:

 

 [2003-07-24 03:20 UTC] christoph at chcnet dot net
Description:
------------
When calling my scripts like that:

/path/script.php?parm1=1&parm2=3 ....

via Javascript

<script language="javascript">
window.open("/path/page.php?parameter=123&clientname=some name", data)
</script>

IIS returns a screen:

CGI Error: The cgi application misbehaved by returning wrong HTTP-Headers. Those are:


(nothing here...)

Obviously php in version 4.3.2 under IIS 5 on Win2k (SP4) advanced server crashes.

setting error reporting to E_ALL doesn't show any hint, php simply disappears without sending anything, and IIS prints the above mentioned error message.

No zombie processes (php.exe) remain in the system, as the application obiously quits correctly so I don't even get a message window, that php.exe crashed (I have visual studio installed).

Is this a configuration issue (I haven't found nothing so far), because the PHP version I use on my production machine works without errors.

Yes, I use $_GET and $_POST instead of using global variables (although I have it enabled, because an older system, written in php requires it)



Reproduce code:
---------------
function show_documents($docid) {
    print $docid;
}
function update_documents($docid) {
	global $db;
	if ($_POST['parm1']=="") $_POST['parm1'] = 0;
	if ($_POST['parm2']=="") $_POST['parm2'] = 0;
        print "updating...";
        $sql = "update table set parm1=${_POST['parm1']};";
        mssql_query($sql, $db) or die ("ERROR!");
	?>
	<script>
	window.open(<?php print "\"documents.php?parm1=${_POST['parm1']}&parm2=${_POST['parm2']}\""; ?>,"data")
	</script>
	<?php
}


switch ($mode) {
	case "updatedoc": update_documents($docid); break;
	default: show_documents($docid); break;
}


Expected result:
----------------
calling the script from a form providing parm1 and parm2 does on 4.3.1-dev:

1) print updating.... and redirect the webpage to the same script without parameter mode=updatedoc (this is for Updates and inserts in SQL, so that the insert statement is not called 2x (and also the update)

The update script is called correctly, but when 


2) open the same script documents.php?docid=123
   should print 123


Actual result:
--------------
CGI Error... Application misbehaved by not returning a complete set ot HTTP headers:




(here is nothing else, so PHP didn't write anything....

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-24 03:24 UTC] helly@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You cannot use spaces in URLs.
 [2003-07-24 03:27 UTC] helly@php.net
Ups, you say PHP crashes? That of course shouldn't happen
 [2003-07-24 04:38 UTC] sniper@php.net
It doesn't crash. Are you sure you're using the correct binary? (CGI, not CLI?) Check the version with 'php -v'

 [2003-07-24 05:31 UTC] christoph at chcnet dot net
I use the c:\php\php.exe version (this is the one, which is installed automatically with the windows installer). the bug occurs not in all cases but only in those, I posted a sample about...

I said, that the program obviously doesn't crash (as I don't get a Dr. Watson and there don't remain dead processes).
BUT: In case, there is an error in the script (which hopefully isn't, because it is running on 4.3.1 dev version on my production environment WITHOUT any problem). Only on my test server, which I set up with the newest stable php version 4.3.2 from this website this nasty error occurs. I changed only a few settings of the distributed php.ini and changed the error level from E_ALL to E_ALL ~ E_NOTICE
but that doesn't help anyhow...
 [2003-07-24 05:33 UTC] christoph at chcnet dot net
it's a bug anyhow, because PHP shouldn't quit without saying at least "hey, there was an error! fix it".... But it simply doesn't work...
 [2003-07-24 06:19 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And check the php.ini for cgi.* options and paste them here.
(if the snapshot doesn't fix this)

 [2003-07-24 06:53 UTC] christoph at chcnet dot net
I'm using the standard settings in c:\winnt\php.ini, which is installed by the windows installer (I didn't want to set up IIS by hand ;-))

on those cgi* I didn't change anything.

Later this day I'll test the new version... What has been changed?
 [2003-07-24 08:17 UTC] sniper@php.net
Note: Set to open only when requested feedback is given.
Lot of bugs are fixed in the STABLE branch.
Some cgi.* ini options need to be 1 or 0 instead of what they used to be. (can not remember right now which one)


 [2003-07-29 07:26 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC