|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-01-10 11:42 UTC] nunoplopes at sapo dot pt
Description:
------------
When using the given code, ob_flush() doesn't output all the buffer. When using ob_get_flush() it works as expected.
Reproduce code:
---------------
<?php
session_start();
output_add_rewrite_var('var', 'value');
echo '<a href="file.php">link</a>';
ob_flush();
output_reset_rewrite_vars();
echo '<a href="file.php">link</a>';
?>
Expected result:
----------------
<a href="file.php?SESSID=xxx&var=value">link</a><a href="file.php">link</a>
Actual result:
--------------
<a href="file.php?SESSID=xxx&var=value">link</<a href="file.php">link</a>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
I think i've tracked this one down to the URL parser, it happens when the argument do_flush is set to false for url_adapt_ext (url_scanner_ex.c line 837) this is because it only expects to do the re-write at the final flush. I modified what was passed in to accept the final flush or a flush halfway through the script execution. Patch --- diff -u url_scanner_ex.c url_scanner_ex.c.patched --- url_scanner_ex.c 2004-02-10 01:29:05.000000000 +0000 +++ url_scanner_ex.c.patched 2004-02-10 01:30:51.000000000 +0000 @@ -918,7 +918,8 @@ size_t len; if (BG(url_adapt_state_ex).url_app.len != 0) { - *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) (mode&PHP_OUTPUT_HANDLER_END ? 1 : 0) TSRMLS_CC); + *handled_output = url_adapt_ext(output, output_len, &len, (zend_bool) ((mode & PHP_OUTPUT_HANDLER_CONT) || (mode +& PHP_OUTPUT_HANDLER_END) ? 1 : 0) TSRMLS_CC); if (sizeof(uint) < sizeof(size_t)) { if (len > UINT_MAX) len = UINT_MAX;