ID: 30444
Updated by: [EMAIL PROTECTED]
Reported By: eikke at eikke dot com
-Status: Open
+Status: Feedback
Bug Type: Output Control
Operating System: Gentoo Linux and others
PHP Version: 4.3.9
New Comment:
Try it using CLI SAPI, without any browser between you and result.
Previous Comments:
------------------------------------------------------------------------
[2004-10-15 14:02:52] eikke at eikke dot com
Well, actually I only tested this using Firefox, caus thats the only
browser I got.
The strange thing is a script like this:
<?php
echo "test&";
?>
works perfectly...
------------------------------------------------------------------------
[2004-10-15 12:52:00] [EMAIL PROTECTED]
This is most likely a browser issue, which simply doesn't know how to
interpret & (the start of an entity). Does it work if you use a
different character than &?
------------------------------------------------------------------------
[2004-10-15 11:56:06] eikke at eikke dot com
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 this bug report at http://bugs.php.net/?id=30444&edit=1