I've done some testing, and it seems that Apache messes with the server
variables when it sends the error document.
Basically, Apache does *NOT* send an HTTP 302 response. It sends an
HTTP 404 response, but outputs the full code from the ErrorDocument.
Unfortunately, it changes the REQUEST_METHOD from "POST" to "GET".
Also, it creates the following:
REDIRECT_ERROR_NOTES
REDIRECT_REQUEST_METHOD
REDIRECT_STATUS
REDIRECT_URL
(See http://httpd.apache.org/docs/custom-error.html for more information
on the variables)
REDIRECT_REQUEST_METHOD contains POST. Also, CONTENT_TYPE is *still*
"application/x-www-form-urlencoded" and CONTENT_LENGTH still equals the
size of the POST data, so the data *IS* still being sent, though PHP is
most likely ignoring the data since the method does not equal POST.
Can anyone from the development team verify this? (CC'ing to php-dev in
a separate email so additional comments don't get CC'd as well)
If this is the case, this may be a good one for a feature request.
If not, using the RewriteEngine may be your only choice.
(Looking in /main/main.c, it seems that POST data *is* only parsed when
REQUEST_METHOD=POST, so it may end up only being a single line patch)
Let us know if you plan on requesting a new feature.
Jaime Bozza
-----Original Message-----
From: [ rswfire ] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 4:04 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] form posting to a fake page
No, the error handler does not have access to the posted data. The
problem
in a nutshell:
1. Person fills out form; clicks submit
2. Form action property is called; server notices the page is not real
(Data is lost here)
3. Error handler is called
----Original Message Follows----
From: Miguel Cruz <[EMAIL PROTECTED]>
To: "[ rswfire ]" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] form posting to a fake page
Date: Wed, 17 Apr 2002 16:00:17 -0500 (CDT)
Your error handler would read them and then construct a redirect
containing the form data in querystring format.
miguel
On Wed, 17 Apr 2002, [ rswfire ] wrote:
> $_POST[] variables do not exist on a redirected page; that's the
problem!
>
> ----Original Message Follows----
> From: Miguel Cruz <[EMAIL PROTECTED]>
> To: "[ rswfire ]" <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> Subject: Re: [PHP] form posting to a fake page
> Date: Wed, 17 Apr 2002 15:56:32 -0500 (CDT)
>
> On Wed, 17 Apr 2002, [ rswfire ] wrote:
> > It would still require some knowledge of the posted data. If
someone
> clicks
> > a submit button, and it is posting to a page that doesn't really
exist,
> then
> > when the index.php file gets called as a 404 errordocument, the
posted
> > variables are already lost, so it wouldn't be possible to access
the
> posted
> > variables in any fashion. The only possibility might be if Apache
had
> some
> > way of dealing with this scenario and I am not that familiar with
how
> Apache
> > works. And so, that leaves me with the only workaround I do know,
post
> to a
> > page that does exist! It's just not the ideal solution, but it
works.
>
> Well, depending on the quantity of posted data, you could go through
> $_POST[] and turn them into GET args and pass them along to the
> appropriate page (not that I really understand what you're trying to
do).
>
> miguel
>
>
>
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php