#35933 [NEW]: URL rewriting fails on ob_get_contents()
| From: | ernest at vogelsinger dot at | Date: | Sun, 08 Jan 2006 16:46:14 +0000 |
| Subject: | #35933 [NEW]: URL rewriting fails on ob_get_contents() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-91660@lists.php.net to get a copy of this message | ||
From: ernest at vogelsinger dot at
Operating system: any
PHP version: 5.1.1
PHP Bug Type: Output Control
Bug description: URL rewriting fails on ob_get_contents()
Description:
------------
URL Rewriting fails on ob_get_contents().
Note: the workaround is to have second buffering envelope which gets
flushed into the first, thus triggering the URL rewrite. The two lines
necessary for the workaround are commented out in the code example.
Reproduce code:
---------------
<?php
$output = <<<EOF
<html><body>
<a href=".">self link</a>
</body></html>
EOF;
ob_start();
// *** ob_start();
session_start();
echo $output;
// *** ob_end_flush();
$data = ob_get_contents();
ob_end_clean();
echo '<xmp>';
if (defined('SID'))
echo 'URL should be rewritten having: ', SID, "\n";
else
echo "No SID, no rewritten URL\n";
echo "<xmp>$data</xmp>";
?>
Expected result:
----------------
URL should be rewritten having:
PHPSESSID=667e6b2bde474a2820c8e0f8dc41200f
<html><body>
<a href=".?PHPSESSID=667e6b2bde474a2820c8e0f8dc41200f">self link</a>
</body></html>
Actual result:
--------------
URL should be rewritten having:
PHPSESSID=667e6b2bde474a2820c8e0f8dc41200f
<html><body>
<a href=".">self link</a> </body></html>
--
Edit bug report at http://bugs.php.net/?id=35933&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35933&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35933&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35933&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35933&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35933&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35933&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35933&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35933&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35933&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35933&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35933&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35933&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35933&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35933&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35933&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35933&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35933&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35933&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35933&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35933&r=mysqlcfg