From: eikke at eikke dot com
Operating system: Gentoo Linux and others
PHP version: 4.3.9
PHP Bug Type: Output Control
Bug description: Buffer doent get flushed
Description:
------------
When running the following code, the output in browser isn't what one
would expect (there's a "&" missing).
If one outputs something after the echo(substr()) (like, echo "test") it
works fine, also if one outputs characters after the "?>"
This bug has been confirmed by Saveas on #php, freenode, running PHP 4.3.2
on Debian Apache1, and by me on 2 mod_php 4.3.9, Apache 2.0.51 Gentoo Linux
systems (twice another configuration tough)
It does look like a buffer flush problem.
Reproduce code:
---------------
<?php
$t = array("t","e","s","t","j","e");
array_push($t, "t");
array_unshift($t, "");
var_dump($t);
echo "\n<br />";
$tmp = implode("&", $t);
echo $tmp;
echo "\n<br />";
echo(substr($tmp, 0, -1));
//echo "<br />test";
?>
Expected result:
----------------
array(8) { [0]=> string(0) "" [1]=> string(1) "t" [2]=> string(1) "e"
[3]=> string(1) "s" [4]=> string(1) "t" [5]=> string(1) "j" [6]=>
string(1) "e" [7]=> string(1) "t" }
&t&e&s&t&j&e&t
&t&e&s&t&j&e&
Actual result:
--------------
array(8) { [0]=> string(0) "" [1]=> string(1) "t" [2]=> string(1) "e"
[3]=> string(1) "s" [4]=> string(1) "t" [5]=> string(1) "j" [6]=>
string(1) "e" [7]=> string(1) "t" }
&t&e&s&t&j&e&t
&t&e&s&t&j&e
--
Edit bug report at http://bugs.php.net/?id=30444&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30444&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30444&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30444&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30444&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30444&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30444&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30444&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30444&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30444&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30444&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30444&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30444&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30444&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30444&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30444&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30444&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30444&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30444&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30444&r=mysqlcfg