Check this out: bash-2.05$ cat test.php <?php
function jpcache_debug2($s2) { $length = strlen($s2); $length++; $headers = "X-CacheDebug-five: $length"; header($headers); print $length . "\n"; print strlen($s2); } $myVariable = serialize($_POST); jpcache_debug2($myVariable); ?> <html> <body> <form method="POST" action="test.php" enc-type="multipart/form-data"> <input type="hidden" name="foo" value="bar"> <input type="submit" value="blah"> </form> </body> </html> bash-2.05$ Response: Date: Tue, 24 Aug 2004 14:35:55 GMT Server: Apache/1.3.26 (Unix) mod_ssl/2.8.9 OpenSSL/0.9.6k PHP/4.3.3 mod_perl/1.26 mod_fastcgi/2.2.10 X-Powered-By: PHP/4.3.3 X-CacheDebug-five: 7 Connection: close Transfer-Encoding: chunked Content-Type: text/html 27 26 <html> <body> <form method="POST" action="test.php" enc-type="multipart/form-data"> <input type="hidden" name="foo" value="bar"> <input type="submit" value="blah"> </form> </body> </html> How the bloody hell is $length being treated differently? Thanks, Eric -----Original Message----- From: Daniel Schierbeck [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 24, 2004 4:53 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Crazy Serialize/Header/$_POST PHP Error - Is this a bug? Eric Peters wrote: > I think I've boiled my problem....for some reason I can't header() a > serialized $_POST variable > > Running PHP 5.0 Final (and also tested with 4.3.3): > > -- begin file -- > > <?php > > function jpcache_debug2($s) > { > header("X-CacheDebug-five: $s"); > print $s; > } > > $myVariable = serialize($_POST); > jpcache_debug2($myVariable); > > ?> > > <html> > <body> > > <form method="POST" action="test-error.php"> <input type="hidden" > name="foo" value="bar"> <input type="submit" value="blah"> </form> > </body> </html> > > > -- end file -- > > Response Headers - Begin output: > > Date: Mon, 23 Aug 2004 23:56:14 GMT > Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) PHP/5.0.0 mod_ssl/2.8.12 > OpenSSL/0.9.6b > X-Powered-By: PHP/5.0.0 > X-CacheDebug-five: a:0:{} > Connection: close > Transfer-Encoding: chunked > Content-Type: text/html > > a:1:{s:3:"foo";s:3:"bar";} > <html> > <body> > > <form method="POST" action="test-error.php"> <input type="hidden" > name="foo" value="bar"> <input type="submit" value="blah"> </form> > </body> </html> > > > Anyone know why my header() output behaves so funky? > > Thanks, > > Eric Try to use unserialize(); -- Daniel Schierbeck -- 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