#24520 [NEW]: Rewriting an URL with mod_rewrite does not register variables properly.
| From: | kouber@php.net | Date: | Mon, 07 Jul 2003 10:27:50 +0000 |
| Subject: | #24520 [NEW]: Rewriting an URL with mod_rewrite does not register variables properly. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-43350@lists.php.net to get a copy of this message | ||
From: kouber@php.net
Operating system: Win2000 NT
PHP version: 4.3.2
PHP Bug Type: Apache related
Bug description: Rewriting an URL with mod_rewrite does not register variables properly.
Description:
------------
When I write some RewriteRule with additional "redirected" variables, they
seem to be empty in my script.
RewriteRule ([a-z]+/)?([0-9]+) job_view.php?job_sid=$2&theme=$1
When I call the following URL "http://localhost/gray/56", I expect in my
script to have these variables:
job_sid => string(2) "56"
theme => string(4) "gray"
But what var_dump($job_sid) and var_dump($theme) actually tells me is:
job_sid => string(2) "56"
theme => string(0) ""
Note that $theme is an empty string, but not null.
The weirdest thing is that var_dump($_GET) shows correct result:
array(2) {
["job_sid"]=>
string(2) "56"
["theme"]=>
string(4) "gray"
}
I forgot to mention, that I have register_globals=On, so I expect ALL of
my $_GET variables to be registered as globals.
Reproduce code:
---------------
var_dump($_GET);
var_dump($job_sid);
var_dump($theme);
Expected result:
----------------
array(2) {
["job_sid"]=>
string(2) "56"
["theme"]=>
string(4) "gray"
}
string(2) "56"
string(4) "gray"
Actual result:
--------------
array(2) {
["job_sid"]=>
string(2) "56"
["theme"]=>
string(4) "gray"
}
string(2) "56"
string(0) ""
--
Edit bug report at http://bugs.php.net/?id=24520&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24520&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24520&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24520&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24520&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24520&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24520&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24520&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24520&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24520&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24520&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24520&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24520&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24520&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24520&r=gnused