Re: #11498 [NEW]: Relative URI location breaks PATH_INFO

From: Date: Fri, 15 Aug 2003 11:09:53 +0000
Subject: Re: #11498 [NEW]: Relative URI location breaks PATH_INFO
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-15597@lists.php.net to get a copy of this message
Hello, can you please refile this bug, we had some problems so we had to restore a backup. Sorry for the inconvienience. Derick On Fri, 15 Aug 2003, phpbugs at lusis dot org wrote: > From: phpbugs at lusis dot org > Operating system: gentoo 1.4 > PHP version: 4.3.2 > PHP Bug Type: Apache2 related > Bug description: Relative URI location breaks PATH_INFO > > Description: > ------------ > I was testing some session-setting code that uses PATH_INFO to set session > variables from PATH_INFO. After exploding PATH_INFO and using the > information, I wanted to redirect back to the page. > > This didn't work as expected. The page I was attempting to redirect to was > treated as a PATH_INFO value. > > The only way to resolve this was to use an absolute URL as the Location. > > The whole purpose is to have a single page as the URL. > > An example URL is: > > http://hostname/~username/directory/main.php/1/2 > > This would set the current menu to 1 and the current task as 2. These > values are for a sort of breadcrumb system. The tasks are specific to a > menu and are pulled from a database to build the tasklist. > > What ends up happening is $menu gets overwritten with main.php instead of > 1. > > When this is moved to production, the desired URL will actually be: > > http://hostname/main.php/1/2 > > which should redirect to: > > http://hostname/main.php after parsing the PATH_INFO. > > Reproduce code: > --------------- > $MYURL="http://hostname/~username/directory/" > list($dummy,$menu,$task)=explode('/',$_SERVER['PATH_INFO']); > if($task) > { > $_SESSION['CurrentMenu'] = $menu; > $_SESSION['CurrentTask'] = $task; > // This works > header("Location: ".$MYURL."main.php"); > // This does not: > // header("Location: main.php"); > exit; > }else($menu){ > $_SESSION['CurrentMenu'] = $menu; > header("Location: ".$MYURL."main.php"); > exit; > } > > Expected result: > ---------------- > PATH_INFO should be parsed properly. > > PAge should be refreshed as main.php with the session variables set as > shown. > > Actual result: > -------------- > $menu gets overwritten with main.php instead of 1 after first redirect. > > -- ------------------------------------------------------------------------- Derick Rethans http://derickrethans.nl/ JDI Media Solutions http://www.jdimedia.nl/ International PHP Magazine http://www.php-mag.net/ -------------------------------------------------------------------------

« previous php.qa (#15597) next »