#19265 [NEW]: header + relative location + cgi + aliasmatch fails

From: Date: Fri, 06 Sep 2002 14:36:01 +0000
Subject: #19265 [NEW]: header + relative location + cgi + aliasmatch fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18577@lists.php.net to get a copy of this message
From: steve@bluearena.com Operating system: Linux PHP version: 4CVS-2002-09-06 PHP Bug Type: Output Control Bug description: header + relative location + cgi + aliasmatch fails 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 bug report at http://bugs.php.net/?id=19265&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19265&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19265&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19265&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19265&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19265&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19265&r=support Expected behavior: http://bugs.php.net/fix.php?id=19265&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19265&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19265&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19265&r=globals

« previous php.bugs (#18577) next »