From: ericp at amazon dot com
Operating system: Linux 2.4.21-2.3a i686
PHP version: 5.0.1
PHP Bug Type: Variables related
Bug description: Variable is treated differently in header() vs print()
Description:
------------
If I include a serialized variable in header() it produces an entirely
different result than if I just print() the result...
I've also tested: 4.3.3, 5.0.0 and of course 5.0.1 and its reproducable in
both scenario
Make sure you POST the form to get the variable back :)
even a strlen($s) will produce different results...its weird.
Thanks,
Eric
Reproduce code:
---------------
<?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>bash-2.05$
Expected result:
----------------
Response Headers
Date: Tue, 24 Aug 2004 14:49:52 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) PHP/5.0.1 mod_ssl/2.8.12
OpenSSL/0.9.6b
X-Powered-By: PHP/5.0.1
X-CacheDebug-five: a:1:{s:3:"foo";s:3:"bar";}
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>
Actual result:
--------------
Response Headers
Date: Tue, 24 Aug 2004 14:49:52 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) PHP/5.0.1 mod_ssl/2.8.12
OpenSSL/0.9.6b
X-Powered-By: PHP/5.0.1
X-CacheDebug-five: a:0:{} <--- WHAT?!?
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>
--
Edit bug report at http://bugs.php.net/?id=29820&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29820&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29820&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29820&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29820&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29820&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29820&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29820&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29820&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29820&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29820&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29820&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29820&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29820&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29820&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29820&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29820&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29820&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29820&r=float