ID:               19265
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         Output Control
 Operating System: Linux
 PHP Version:      4CVS-2002-09-06
 New Comment:

I am trying to demonstrate that the same PHP code which works on the
Apache module, fails with the CGI module. Both with Internet Explorer
as the client.


Previous Comments:
------------------------------------------------------------------------

[2002-10-08 12:09:18] [EMAIL PROTECTED]

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.

If people use incorrect (relative pathes) in the Location: header they
cannot expect consistent behaviour. It may work in some browser and it
may not work in others. 

------------------------------------------------------------------------

[2002-09-07 06:28:24] [EMAIL PROTECTED]

A relative location works most of the time. It always works with the
Apache module, and the CGI version only fails when the aliasmatch
directive is set.

Anyway, I worked around this by using mod_rewrite instead of
AliasMatch, so I'm not particularly bothered - but I'm quite sure that
a lot of people use relative URIs with the Location header so it might
be worth looking into.

I realise the official standard says the URIs should be absolute, but
IE, Netscape, and Lynx, maybe others, support relative.

Steve

------------------------------------------------------------------------

[2002-09-06 19:40:38] [EMAIL PROTECTED]

First of all, your redirect is wrong.
You must use absolute URI for Location header.

Try absolute URI, if it fixes.


------------------------------------------------------------------------

[2002-09-06 09:36:01] [EMAIL PROTECTED]

I have run into a problem with the above setup on both the latest
snapshot and also 4.2.2 - sorry if it's not a bug.

<?
if(!$test) die(header("Location: /?test=true"));
else die("redirected ok: $REQUEST_URI");
?>

This works fine, and as expected, the output is:
redirected ok: /?test=true

However if I have the following lines in my httpd.conf:
DocumentRoot /home/bla/html
AliasMatch ^/sess/(.{4})/(.*) /home/bla/html/$2

And change the script to:
<?
if(!$test) die(header("Location: /sess/1234/?test=true"));
else die("redirected ok: $REQUEST_URI");
?>

The output is:
redirected ok: /

I'm not quite sure what is going on here. I have just switched from an
Apache module to CGI version for security reasons and wasn't quite
expecting this problem so came into an interesting problem, a loop in
my program, and crashes out with an error 500:

GET / HTTP/1.0
host: www.mydomain.com

HTTP/1.1 500 Internal Server Error
Date: Fri, 06 Sep 2002 14:30:35 GMT
Server: Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.10 OpenSSL/0.9.6g
X-Powered-By: PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3,
PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3, PHP/4.2.3
Connection: close
Content-Type: text/html; charset=iso-8859-1


Changing it to a absolute URL in the header("Location   fixes the
problem but it would be a pain to change this in all my scripts. Thanks
a lot for your help.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=19265&edit=1

Reply via email to