Jump to content

Flush is removing part of string?


ZachMEdwards

Recommended Posts

Hey guys! I found a flush function and it seems to be working well, but sometimes it will cut off characters. It's very strange.

 

Here's my flush function:

	function out($str) {
	echo $str."<br />\n";
	vbflush();
}

function vbflush() {
	if (ob_get_length()){           
		@ob_flush();
		@flush();
		@ob_end_flush();
	}   
	@ob_start();
}

And I'm calling it like this:

out('Waiting 30 seconds until execution');

And this is my output:

Waiting 30 seconds until executio

Anyone know why?

Link to comment
Share on other sites

That's very strange indeed.  I've copied that code exactly and saved it to my server, and the output is as expected.

 

See it here..

 

I wonder if it has anything to do with the line feed at the end of the string?  It seems that only the final letter 'n' is cut off, so perhaps there is something with the '\n' that is causing it?  This shouldn't be the case, but I can't see what else would even possibly cause that.  Does it still do it if you remove the line feed?  And what about changing the single quotes to double quotes when you call the out() function?

 

Try changing your parameter to a string that ends in a letter other than n.  Whatever the case, it seems to be exclusive to your server, so you must have a setting somewhere that is causing it.

 

Also, is it cutting off the <br /> tag as well?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.