php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28182 Output is retained and is not sent immediately to client
Submitted: 2004-04-27 15:09 UTC Modified: 2004-04-27 17:24 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fabiogsilva at fabio0101 dot x-br dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: Irrelevant OS: Linux/Windows
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fabiogsilva at fabio0101 dot x-br dot com
New email:
PHP Version: OS:

 

 [2004-04-27 15:09 UTC] fabiogsilva at fabio0101 dot x-br dot com
Description:
------------
To illustrate the problem, I'll write a script that sends two JavaScript blocks that capture the client's current date.

I have written this code with and without buffer control, and the result is the same.

Reproduce code:
---------------
<script>
var init_date = new Date();
</script>

<?
//Waiting 5 seconds to send the next JavaScript block...
sleep(5);
?>

<script>
var end_date = new Date();
alert("Init Date: " + init_date + "\nEnd Date: " + end_date);
</script>


Expected result:
----------------
The two dates should not be the same, because the first block  would be sent immediately, and the 2nd one 5 seconds later.

Actual result:
--------------
The two dates are the same. I have not experienced this problem with other languages such as ASP and Perl.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-27 15:43 UTC] luser at uvm dot edu
I can verify this on PHP 4.3.4 running on Solaris with Apache 1.3 and using Mozilla 1.6 (cause wouldn't this be really Javascript/Web browser dependent?).

However, output is sent immediately from the command-line in both PHP 4.3.4 and PHP 5.0.0RC3-dev (built: Apr 26 2004 21:02:28)
 [2004-04-27 17:16 UTC] fabiogsilva at fabio0101 dot x-br dot com
To use another example, consider a script that simply prints plain text:

<?php
header("Content-Type: text/plain");

for($i = 0; $i < 10; $i++) {
	print "Line $i sent to client.\n";
	sleep(1);
}
?>

No matter what browser we use, the result is the same.
 [2004-04-27 17:24 UTC] amt@php.net
This is a feature, not a bug. Look at the 
output_buffering configuration directive in your php.ini 
file. To disable output buffering, set this value to 0.

Also, remember that some browsers (clients) will buffer 
input until it recieves a certain amount of data. There 
is nothing PHP can do about this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC