Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #35933 : URL rewriting fails on ob_get_contents()
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th July 06:52
php-bugs@lists.php.net (ernest at vogelsinger dot
External User
 
Posts: 1
Default #35933 : URL rewriting fails on ob_get_contents()



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 "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
  Reply With Quote


  sponsored links


2 11th July 06:52
sniper
External User
 
Posts: 1
Default #35933 : URL rewriting fails on ob_get_contents()



ID: 35933
Updated by: sniper@php.net
Reported By: ernest at vogelsinger dot at
-Status: Open
+Status: Bogus
Bug Type: Output Control
Operating System: any
PHP Version: 5.1.1
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the do***entation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


Previous Comments:
------------------------------------------------------------------------

[2006-01-08 17:46:13] ernest at vogelsinger dot at

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 "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 this bug report at http://bugs.php.net/?id=35933&edit=1
  Reply With Quote
3 11th July 06:52
php-bugs@lists.php.net (ernest at vogelsinger dot
External User
 
Posts: 1
Default #35933 : URL rewriting fails on ob_get_contents()


ID: 35933
User updated by: ernest at vogelsinger dot at
Reported By: ernest at vogelsinger dot at
Status: Bogus
Bug Type: Output Control
Operating System: any
PHP Version: 5.1.1
New Comment:

Thanks for your omments that this is not a bug - IMHO it is actually a
bug, not a feature.
URL rewriting should happen at the final stage, when the output is
actually flushed back to the client, not at any other obscure location
within the PHP output buffers.
---
I'll post a comment on the respective manual page (which I have read
and fully understood ;->)


Previous Comments:
------------------------------------------------------------------------

[2006-01-08 17:51:49] sniper@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the do***entation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

------------------------------------------------------------------------

[2006-01-08 17:46:13] ernest at vogelsinger dot at

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 "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 this bug report at http://bugs.php.net/?id=35933&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666