php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30444 Buffer doent get flushed
Submitted: 2004-10-15 11:56 UTC Modified: 2004-12-08 01:00 UTC
From: eikke at eikke dot com Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.3.9 OS: Gentoo Linux and others
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: eikke at eikke dot com
New email:
PHP Version: OS:

 

 [2004-10-15 11:56 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-15 12:52 UTC] derick@php.net
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 14:02 UTC] 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-11-27 16:43 UTC] tony2001@php.net
Try it using CLI SAPI, without any browser between you and result.
 [2004-12-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Mar 11 06:01:29 2025 UTC