RE: [PHP] Re: Crazy Serialize/Header/$_POST PHP Error - Is this a bug?
| From: | Peters, Eric | Date: | Tue, 24 Aug 2004 16:04:53 +0000 |
| Subject: | RE: [PHP] Re: Crazy Serialize/Header/$_POST PHP Error - Is this a bug? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194594@lists.php.net to get a copy of this message | ||
I figured it out...wasn't a PHP thing at all but rather the Firefox addin to "view"
response headers
It was cheating and doing a GET to grab the headers instead of the cached POST output.
Thanks for your help John,
Eric
-----Original Message-----
From: John Holmes [mailto:holmes072000@charter.net]
Sent: Tuesday, August 24, 2004 11:42 AM
To: Peters, Eric
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Crazy Serialize/Header/$_POST PHP Error - Is this a bug?
Peters, Eric wrote:
> You have to look at the headers
>
> Exactly...submit the form and the HEADER version of the string returns "a:0:{}"
>
> But, a print() of the same string variable correctly returns
> "a:1:{s:3:"foo";s:3:"bar";}"
>
> Dig deeper into it :)
Okay. Running 4.3.6 and 5.0.0, I see the following requests and responses. I even added a
"X-CacheDebug-six" header that gets the actual value of the serialized $_POST...
*** FIRST REQUEST TO test.php ***
----------------------------------------------------------
http://grape/test.php
GET /test.php HTTP/1.1
Host: grape
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20040803 Firefox/0.9.3
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Tue, 24 Aug 2004 18:36:43 GMT
Server: Apache/1.3.31 (Win32) PHP/5.0.0
X-Powered-By: PHP/5.0.0
X-CacheDebug-five: 7
X-CacheDebug-six: a:0:{}
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
So you can see how the correct length and value are sent in the headers.
Printing $s2 (within the function) shows a:0:{}
----------------------------------------------------------
*** SECOND REQUEST (POST) TO test.php ****
----------------------------------------------------------
http://grape/test.php
POST /test.php HTTP/1.1
Host: grape
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20040803 Firefox/0.9.3
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://grape/test.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 7
foo=bar
HTTP/1.x 200 OK
Date: Tue, 24 Aug 2004 18:36:57 GMT
Server: Apache/1.3.31 (Win32) PHP/5.0.0
X-Powered-By: PHP/5.0.0
X-CacheDebug-five: 27
X-CacheDebug-six: a:1:{s:3:"foo";s:3:"bar";}
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
----------------------------------------------------------
Again, here you can see how the length and value are correct.
If you're not seeing the same thing with 4.3.3, then upgrade.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals - www.phparch.com